5 Years
Discussion Span
Last Post by limaulime

Oh someone can put a value in and the program would save it with a simple althogram. (*8776+8)
It has no connection to what I'm trying to do.


No like the person can type the name of the file an it would use that. The contense of the files isn't really my problem. The program can open and decode the file or make a file and encrypt it. How could I use user imput as the filename.


Oh switched from string to char[] and it worked. Guess code::blocks strings arnt legit in this senario.


First of all you need to define file stream

#include <fstream>

Next you need to declare the file reference

ifstream infile ("filename.txt");//this is the name of the input file
ofstream outfile ("filename2.txt"); //this is the name of output file

then only you can read the data from input file and write to another file

infile >>firstname >>lastname; //reading from input file
outfile >>"Name:" >>firstname >>lastname;//write to output file

it should works for VC++ or code::blocks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.