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?

View 4 Replies


ADVERTISEMENT

C++ :: Display Last 1000 Lines From Multiple Text Files (log Files)

Jan 16, 2014

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.

View 6 Replies View Related

C++ :: Add Data To Text Files Which Are Required To Store 3D Scan Data

Jul 10, 2013

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.

#include <string>
#include <locale>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;

[Code] ....

View 1 Replies View Related

C++ :: Sharing Data Between 2 Files

Aug 30, 2013

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.

View 2 Replies View Related

C++ :: Comparing Two Data Files?

Feb 15, 2013

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.

View 1 Replies View Related

C++ :: Retrieve Data / Files From A Server?

Feb 25, 2013

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.

View 3 Replies View Related

C++ :: How To Generate Two Files And Write Data Into

Apr 5, 2013

I try to write my data into two different files and i just use something like this

ofstream myfile;
myfile.open("phase 1.txt");
if (myfile.is_open()) {
for(i=0;i<M; i++) {

[Code] .....

But it only generate the first file. How should i modify this?

View 2 Replies View Related

C++ :: How To Write Data Into Multiple / Different Files

May 7, 2013

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.

#include<fstream>
#include<iostream>
#include <cstdlib>
#include <algorithm>
#include<list>
#include <math.h>
#include<conio.h>
#include<string>
#define PI 3.14159265
using namespace std;
double angle;
ifstream indata;
ofstream outfile;

[Code] .....

View 1 Replies View Related

C/C++ :: Writing Data To Files To Be Called Later?

Apr 5, 2014

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:

void WriteToFile() {
if(myfile.is_open()) {
myfile.open("userdata.txt",ios::in);
myfile<<"User name: "<<NameFirst<<" "<<NameLast<<"

[Code] ....

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>.

View 4 Replies View Related

C :: Working With Files / Struct And Manipulating Data

Dec 17, 2013

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.

Code:

#include<stdio.h>
#include<stdlib.h>
#define FILENAME "file.txt"
#define SIZE 100
}

[code]....

View 3 Replies View Related

C++ :: Converting Characters To Numbers Using Data Files

Feb 20, 2013

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)

[code]....

View 1 Replies View Related

C++ :: Data Buffer With Memory Mapped Files?

Jan 27, 2014

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.

View 2 Replies View Related

C++ :: Reading Stream Data From PDF Files Compressed In LZW?

Nov 28, 2013

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
}

View 14 Replies View Related

C++ :: I/O Streams And Data

Apr 27, 2012

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;

[Code] .....

View 1 Replies View Related

C++ :: Strcmp Function - Comparing String Data From Two Different Files

Dec 20, 2013

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.

// final project2 file

#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>

using namespace std;
const int ARRAY_SIZE = 500;
const int MARKET_ARRAY = 6;
ifstream infile, infile2;
ofstream outfile;

[Code] .....

View 6 Replies View Related

C++ :: Taking Data From Files And Output Information To Another File

Apr 2, 2014

Whenever I run my program, It should be taking this string of information:

Shampoo 10 8.75 87.50
Pen 3 2.50 7.50
Headphones 5 20.99 104.95
MacAir 1 879.23 879.23

Raspberries 6 4.99 29.94
Oranges 5 2.79 13.95
Apples 3 3.85 11.55

From one file and outputting it to another, the finished product should look like:

Shampoo 10 8.75 87.50
Pen 3 2.50 7.50
Headphones 5 20.99 104.95
MacAir 1 879.23 879.23

cheapest item = Pen
most expensive item = MacAir
total cost = 1079.18
shopper = Mary Kay

Raspberries 6 4.99 29.94
Oranges 5 2.79 13.95
Apples 3 3.85 11.55

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?

CODE:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <float.h>
#include <sstream>
#include <string>
using namespace std;
ifstream input_file;
ofstream output_file;

[Code] ....

View 1 Replies View Related

Visual C++ :: Should Precompiled Header Files Also Be Included In Source Header Files?

Sep 16, 2013

When including a header file in stdafx.h, should that file still be included in the source file where it is actually used?

If it is included in both places, is the one in the source file ignored?

View 5 Replies View Related

C++ :: Write Data Into Files In A For Loop - Debug Assertion Failed?

Apr 14, 2012

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.

View 7 Replies View Related

C/C++ :: Program To Print Alternate Records From A File

Aug 23, 2013

Code for the following.

How to print alternate records from a file using fseek?

View 5 Replies View Related

C++ :: Generate Two TXT Files In One Program

Apr 4, 2013

I try to write my data into two different files and i just use something like this

ofstream myfile;
myfile.open("phase 1.txt");
if (myfile.is_open()) {
for(i=0;i<M; i++)

[Code] ....

But it only generate the first file. How should i modify this?

View 3 Replies View Related

C++ :: How To Use Two Header Files In Program

Sep 17, 2013

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.

View 5 Replies View Related

C :: Program Reading / Writing Files

Dec 10, 2013

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.

Code: #include <stdio.h>
#include <stdlib.h>
//#include "kim.h"
#include <string.h>
[code]....

View 4 Replies View Related

C :: Program To Write Even And Odd Integers Into Different Files

Sep 7, 2014

-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.

The output of the program will look like this.

How many records that you want to store :41

2
3
4

The data are written too the respective files.

The even numbers are 2 4
The odd numbers are 1 3

View 9 Replies View Related

C++ :: How To Test A Program By Using Files Containing Tests

Sep 15, 2014

How to test a program by using files containing tests and with a go file i think.

View 1 Replies View Related

C++ :: Uploading And Downloading Files In A Program

Feb 19, 2015

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?

View 1 Replies View Related

C/C++ :: Program To Compare Two Text Files?

Jan 28, 2015

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.

i dont know how to start or what to do with this.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved