• Advertisement


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

multidisk copy routine malfunctioning

This topic is 6538 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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(); fout.open("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

  • Advertisement