Im trying to write a piece of code to open all files in the current
directory, read their contents and write it out to another file.
However after the program runs the output files are not there. Through
debugging I know the (output)files are being opened and the info. is being
wrote to them. But there is no files anywhere when the program finishes??
A piece of code used:
while( _findnext( hSearch, &FileData ) == 0 )
{
cout<<"FILE "<<FileData.name;
wFileIn.clear();
wFileIn.open(FileData.name,ios::in||ios::binary);
if(!wFileIn.is_open())
{
cout<<"File "<<FileData.name<<" could not be opened"<<endl;
}
else
{
getOutputFile(FileData.name,wOut);//gets the name of output file
wFileOut.clear();
wFileOut.open(wOut,ios::in||ios::out||ios::binary) ;
//read in data
//...
for(int i = 0;i < 27;i++)
wFileOut<<i;
wFileIn.close();
wFileOut.close();
}
}
_findclose( hSearch );
exit(0);
Thanks