Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
fread/fwrite
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Joe Wright, post: 2960786"] Maybe this way.. #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { FILE *in, *out; char buf[100]; size_t size; if ((in = fopen("cp.c", "rb")) == NULL) puts("Can't open cp.c"), exit(EXIT_FAILURE); if ((out = fopen("cp.x", "wb")) == NULL) puts("Can't make cp.x"), exit(EXIT_FAILURE); while ((size = fread(buf, 1, sizeof buf, in)) > 0) fwrite(buf, 1, size, out); fclose(in); fclose(out); return 0; } Note that cp.c is the name of this source file. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
fread/fwrite
Top