Advertisement

multidisk copy routine malfunctioning

Started by March 31, 2000 08:42 PM
-1 comments, last by BeanDog 24 years, 7 months ago
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 <= ''z'';i++){}; return i; } Thanks. </i>

This topic is closed to new replies.

Advertisement