I'm having difficulty opening a destination file using an array called "mystring" in the line
instream4.open(mystring);
First, I open an instream file that contains the following:
C078D2A2.DAT
C078D9E4.DAT
I take the first 12 characters from the file and insert them into an array called "mystring." The content of the array "C078D2A2.DAT" is actually the name of a file that I want to open and copy its contents to a newly created file. So, I open the file with the following:
instream4.open(mystring);
Then, I create a new destination file that has the same file name as the source file, but I place the file somewhere else by appending a path to the file name with the following:
char path[28]="h:\\newfolder\\";
strcat(path, mystring);
and finally open the destination file with the following:
outstream4.open(path, ios::app);
After I copy the contents to this newly created outstream file, I close the instream file and the outstream file, clear the array, and begin the process over again by collecting the next 12 characters (C078D9E4.DAT).
The first file copies perfectly, but my problem lies in the opening of the second file ("C078D9E4.DAT"). In fact, the array seems to be perfect (the characters C078D9E4.DAT are inserted into the array "mystring"), but when I try to open the file with
instream4.open(mystring);
it fails to open. I'm fairly sure that my instream and outstream files are closed before they're opened, so I don't know why this second file isn't opening. Any ideas?
instream4.open(mystring);
First, I open an instream file that contains the following:
C078D2A2.DAT
C078D9E4.DAT
I take the first 12 characters from the file and insert them into an array called "mystring." The content of the array "C078D2A2.DAT" is actually the name of a file that I want to open and copy its contents to a newly created file. So, I open the file with the following:
instream4.open(mystring);
Then, I create a new destination file that has the same file name as the source file, but I place the file somewhere else by appending a path to the file name with the following:
char path[28]="h:\\newfolder\\";
strcat(path, mystring);
and finally open the destination file with the following:
outstream4.open(path, ios::app);
After I copy the contents to this newly created outstream file, I close the instream file and the outstream file, clear the array, and begin the process over again by collecting the next 12 characters (C078D9E4.DAT).
The first file copies perfectly, but my problem lies in the opening of the second file ("C078D9E4.DAT"). In fact, the array seems to be perfect (the characters C078D9E4.DAT are inserted into the array "mystring"), but when I try to open the file with
instream4.open(mystring);
it fails to open. I'm fairly sure that my instream and outstream files are closed before they're opened, so I don't know why this second file isn't opening. Any ideas?