ian reinhart geiser on Wed, 19 Jun 2002 21:32:37 -0400 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Whoa! you are MIXing C and C++... Bad move fstream is what you really want to be using./ fstream f("filename"); string s = ""; f >> s; cout << s; or if you know its text do a getline(f, s); C++ was made so you would not have to do things the hard error prone way all of the time. Only when you have 640k of RAM to play with. Cheers - -ian reinhart geiser On Wednesday 19 June 2002 09:22 pm, Fred K Ollinger wrote: > Here's the whole (broken) function: > > > int voxInstallCommon::cp(char *src, char *dst) > { > #define MAX_BUF 1024 > cout << "src:" << src << ", " << "dst:" << dst<< "\n"; > char buffer[MAX_BUF+1]; > > size_t bytes_read; > FILE *source, *dest; > > source = fopen(src, "r"); > dest = fopen(dst, "w"); > memset(buffer, 0, MAX_BUF); > > bytes_read = fread(buffer, 1, MAX_BUF, source); > > while(bytes_read) > { > fwrite(buffer, 1, bytes_read, dest); > bytes_read = fread(buffer, 1, MAX_BUF, source); > } > > fclose(dest); > return 0; > > } > > > ______________________________________________________________________ > Philadelphia Linux Users Group - http://www.phillylinux.org > Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce > General Discussion - http://lists.phillylinux.org/mail/listinfo/plug -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9ETCnPy62TRm8dvgRAtIiAKCSv+1nOy8FlFG0V+Fgv9Jq9m4+rQCeLk5C cRbhLdmux21i7GheExKTjww= =AUo0 -----END PGP SIGNATURE----- ______________________________________________________________________ Philadelphia Linux Users Group - http://www.phillylinux.org Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce General Discussion - http://lists.phillylinux.org/mail/listinfo/plug
|
|