C :: Program To Hide Files Behind Other Files Using Alternate Data Streams
Apr 5, 2013
I am writing a program to hide files behind other files using Alternate Data Streams in Windows NTFS file systems.
The program is as follows:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void){
char hostfile[75], hiddenfile[75], hiddenFileName[15] ;
printf("Enter the name(with extension) and path of the file whose behind you want to hide another file: ");
scanf("%75s", hostfile);
[Code]...
The complier is showing error as "Extra Perimeter in call to system" but I am not getting where?
I am writing a piece of code that requires me to display the last 1000 lines from a multiple text files (log files). FYI, I am running on Linux and using g++.
I have a log file from which - if it contains more than 1000 lines, I need to display the last 1000 lines. However, the log file could get rotated. So, in case where the current log file contains less than 1000 lines, I have to go to older log file and display the remaining. For e.g., if log got rotated and new log file contains 20 lines, I have to display the 980 lines from old log file + 20 from current log files.
What is the best way to do this? Even an outline algorithm will work.
I have written the following code to add data to text files which are required to store 3D scan data (I have to calculate the y-coordinate). My code seems to work except that it stops working when I want to create more than ten text files i.e. the directory I am trying to store them in will not hold any more than ten text files. Code is shown below.
The problem is I have a function which sets some variables and I want to access the variables, but myfunc() is nested too deeply for me to pass a data structure all the way down and to return all the way up. The functions reside in different files. I'm not allowed to use extern structs (i.e. a global variable).
How to use a class and instantiate it in myfunc(). My solutions are:
- using the singleton class method - static variables and function residing in the class (but I'm suspicious of this way. seems like it's just class variables masquerading as global variables.
I'm trying to compare two data files character by character to see if they are the same. If the files are different, the program should print out the line numbers of where they do not match. So far, I have the part where it returns 'T' for when the files are the same and 'F' when they are not. But how should I start where the program prints out the line number where the characters are different? I am thinking of an array but nor sure how to start it.
I was wondering if i had to say simply retrieve data from a server whether it be simple plain text for variables or download whole files (FTP), what would be the best method for this? I would imagine there is a pretty big difference between retrieving text and downloading files but im just wondering what the best thing would be to research for both.
I am new to c++ programming i just want to know how to write the data into different files.Suppose my input files has 1-8 ids so each id data must be stored into each different file. And below is my code.
I am trying to use myfile to create and write user data to a file [URL].
At the moment I only want to save as .txt so that I can open it to see that it wrote to file properly.
The main issue I get is that it says the file is not open when my program gets to the error checking at the very end, a few guides mentioned that if the file was not yet created a file with the specified name would be generated in the same folder as main on the hard drive. I did try creating the file as a notepad .txt file but it still read the error. Here is the snippet concerning the writing of the file:
it compiles fine with the rest of the program and everything runs smoothly, it just isn't writing to a file.I have included <string>, <iostream> and <fstream>.
I have the following code and I am trying to do simple math calculations to the data. I need to take the car price (y) minus down payment (z) and then divide that quantity by 12 times "yearsx" That answer is then assigned to x. The problem is that x will not print the correctly!I also noticed that if I increase the "count" to amnything higher than the number on lines in the file, I get the correct value for x but only on the last set of the struct..my file reads as follows:
last_name first_name car_price down_payment years johnson bill 10,000 2,000 3
When I printf the struct to the screen, i need to do the following:
x = (10,000 - 2,000)/(12*years);
but this is the math part that wont work. I have checked and doubled checked number types and I cant get it right.
I need to convert characters in a input file to numbers in output file and display both the characters and numbers in a console window.Only 7 numbers can be displayed, the rest needs to be dropped.The input file contains the following data, with one number per line:
CALL HOME GET LOAN Hi THERE BYE FOR NOW
For example, once the first number in the input file has been processed, the console window should display the following: CALL HOME 225 5466.
The output file should now also contain the number: 225 5466
Currently my console is displaying the following:
Enter the input file name. infile.txt
Enter the output file name.
outfile.txt 2554663Invalid Input 4385626Invalid Input 4Invalid Input 84373Invalid Input 293367669Invalid Input 4357637277CALL HOME GET LOAN Hi THERE BYE FOR NOW
#include <iostream> // for screen/keyboard i/o #include <fstream> // for file #include <cstdlib> // for exit using namespace std; void openFile(ifstream& infile)
I have a data buffer project in Windows 7 x64 embedded OS (using Visual Studio 2008), that would work simply like that:
One writer application will send data (no network protocols, just procedure call on the same machine) to my app like 20 packages per second, each data packages will be approximately 3 MB size and comes with a timestamp tag.
My application will store each data item for 100 minutes and then remove. (So I can calculate the total size from beginnig no need for dynamic allocation etc...)
Meanwhile there will be up to 5 reader applications which will query data from my app via Timestamp tag and retreive data (no updates or deletitions on data by reader apps).
So since the data in my buffer app can grow over 50GB I don't think that shared memory is going to work for my case.
I'm thinking about using Boost Memory Mapped Files or Windows API Memory Mapped Files.
So theoratically I will crate a fixed size File on harddisk (lets say 50GB) and then map some portion to RAM write the data to this portion, if the reader applications wants to use the data which is mapped currently on memory, then they will use directly, otherwise they will map some other potion of the file to their address spaces and use from there...
My problem is I haven't use Map File concept at all and I'm not a C++ developer so I'm not very familiar with the language fundementals. I've searched tutorials of boost and msdn for windows as well but there is not too much code example.
So I don't know how to map some portion of the data to memory and manage it, also how to search data in file or memory according to the timestamp tag. Yes there are codes for creating files and mapping the whole file to memory but none for dividing it into regions, aligning or padding the data which I need for my case.
I'm trying to read stream data from a stream in a pdf file compressed in LZW. My first step is to read this compressed data into a buffer. The second step is to decompress it. I know how to decompress it, it is the first step I am having trouble with.
How should I read this data? If I read each character into a char the numerical output will not exceed 256. LZW compressed output should exceed 256.
I read the pdf in binary mode and have tried the read function like below.
From what I understand (don't quote me), I should be reading in 12 bits at a time. Is that correct and if so should I be using a bitfield. If I do need a bitfield then how to I read the data from the stream into a bitfield of 12 bits without restricting the binary value of the characters being read from the compressed stream.
Code: ifstream inputfilestream; inputfilestream.open("myfile.pdf", ios::out | ios::binary); char mychar; //unsigned char gives an error though it can be //converted to unsigned char later. while (inputfilestream.read(mychar, 1)) { // do something with the char.. I have stored it in an int vector }
The goal is to write a c++ program to read the employee.dat(which is this text file below) file created and produce a duplicate copy of the file named employee.bak.
Anthony A 10031 11.82 12182010 Burrows W 10067 12.14 692011 Fain B 10083 10.79 5182011 Janney P 10095 12.57 9282008 Smith G 10105 9.50 12202006
and then the second question is to modify this program to accept the names of the original and duplicate files as user input.
#include <iostream> #include <fstream> #include <cstdlib> // for exit #include <string> using namespace std; int main() { ifstream inFile; ofstream outFile;
I am having a slight issue with the strcmp function. I am comparing string data from two different files. I want the function to output a set of information if the strings are the same and a different set of data if the strings are different. My issue is, the function outputs the data that's the same but not different.
I had an else statement that compared the data if it was NOT equal but it only duplicated the data in the file.
One file is a listing of 100 books with 10 lines of information and an assigned market. The second file is a listing of the markets contained in the books file. However, the books file has a market that is not located in the markets file. The "missing" market is what is not priting or displaying.
cheapest item = Oranges most expensive item = Raspberries total cost = 55.44 shopper = Winnie B. The Pooh
When I run my code however, it doesn't get past shampoo and will continue to add shampoo to the total cost infinitely. How can I change the code to produce the proper information?
In my program I open two files and write data into each, and close them. this is done in a while loop.
int main() { while() { myFile = fopen("file1.txt","w"); myFile2 = fopen("file2.txt","w"); // write data into files using fprintf() in a for loop fclose(myFile); fclose(myFile2); } }
However, after some iterations the fopen() for myFile2 fails.
Debug assertion failed! Program.... File ......srcfprintf.c Line 55
Expression (str != NULL)
I have not been ableto locate the bug in the code that is causing the failure.
I want to use two header files in my program. Here is exactly what I want to do.
-In the first header I have a binary tree and a structure. -In the second file I have another functions that need to use the structure in the first header. -I also want to use a function from the second header in the first. -And finally I want to do actions with both headers in a "main.cpp" file that contains only int main() function.
How to include the headers in each other and in the main.cpp to be able to do the actions above?
I try to include the first header in the second one and the second one in the first header. Then I include both headers in the main.cpp file. But the compiler shows me many errors.
program that I am working on. I want to use fgets() in my program so I could handle multiple words from a text(to be able to handle spaces). I get a weird result when running the program.
-Create three files namely all_numbers, odd_number and even_number. -Get the number of records and the numbers to store from the user. -Save all the numbers in "all_numbers" file. -Read each number and check whether it is odd or even. -Store the odd numbers in odd_number file and even numbers in even_number file. -Finally, print the numbers stored in odd_number and even_number files.
I understand I can do this via a php file on a server, but I don't understand how I can communicate with the php file from c++ code on my machine. Is there some library function I can use to load the html form or data object to hold the php form? Also whats the vibe on amazon EC2 cloud computing servers? It may be out of the scope of this simple program I have uploading and downloading XML, but is this the technology of the future, and should it be embraced now?
i am trying to doing my project what is: Diff - The program should compare two text files and list the differences, i.e. lines and columns of the beginning and the end of a given difference.