i've wrote a code that read and write to some files,
and i have a segmentation fault when i'm running it in the g++ (in the visual studio i don't have any problem like that..)
anyway,
i think the fault may come from this line,
can anyone tell me if it is legal?
tempIn.seekg (tempOut.tellp ());
the declaration:
// pointer to input file
ifstream in;
// pointer to output file
ofstream out;
// pointer to temp file
ifstream tempIn;
ofstream tempOut;
the opening of the files:
out.open("output.txt", ios :: out | ios :: trunc);
in.open ("input.txt");
tempIn.open ("temp.txt");
tempOut.open ("temp.txt", ios :: trunc | ios :: out);
(what i'm trying to do in the first code - to put the in pointer of the file in the place of the out pointer)