#include #include int main(){ FILE *f; char *buf; char ch; int i=0; char str[] = "String to operate with"; f = fopen("./read.txt", "r"); for (;i<5 ;i++ ) { fseek(f,0,SEEK_SET); ch = fgetc(f); str[i] = ch; } /* int len = (int)strlen(str); buf = (char *)malloc(len); f = fopen("./read.txt", "r"); fgets(buf, len, f); printf("received: '%s'\n", buf); fclose(f); */ f = fopen("./write_binary.txt", "wb"); fwrite(str, sizeof(char), 50, f); fclose(f); return 0; }