Jump to content
  • Advertisement


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


multidisk copy routine malfunctioning

This topic is 6809 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

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!