This topic is now archived and is closed to further replies.


multidisk copy routine malfunctioning

Recommended Posts

Here''s my entire source code for a little utility I am making to copy a file across many disks, so as to transport easy. It works good until the first disk fills, then it keeps asking for more without copying anything. Any help? #include int sLength(char* string); int main(int argc, char **argv) { if (argc != 2) { cout<<"Format: havedisk "; return 0; } ifstream fin(argv[1], ios::binary); ofstream fout("A:\\chunk.dat",ios::trunc, filebuf::binary); char fnamelen = sLength(argv[0]); fout.write((char*)&argv[1], fnamelen); char ch; while (fin.get(ch)) { //fout.write((char*)&ch, 1); while (!fout.write((char*)&ch, 1)) { cout<< "Insert next disk and press enter..."; char junk; cin.get(junk); fout.close();"A:\\chunk.dat", ios::trunc, filebuf::binary); } } fin.close(); fout.close(); return 0; } int sLength(char* string) { for(int i = 0; string >= ''0'' && string[i] <= ''z'';i++){}; return i; } Thanks.

Share this post

Link to post
Share on other sites