a question about file operation. 
Author Message
 a question about file operation.

char s_buf[50] = "hehe...";

FILE* fp = fopen("...", "w+b");
fwrite(s_buf, 50, 1, fp);
fwrite(s_buf, 50, 1, fp);
fwrite(s_buf, 50, 1, fp);
int n = ftell(fp);

 Here n should be 150, if I call fclose(fp) here, it will write total 150
bytes to the file,
 But in face, I just want write the first 100 bytes to the file and abnegate
the last 50 bytes,
 How can I do? Thanks!

Fri, 15 Apr 2005 18:07:41 GMT  
 [ 1 post ] 

 Relevant Pages 

1. file operations question

2. fatal error LNK1256: ALINK operation failed (80070002): The system cannot find the file specified

3. File Operations

4. Asking for help on "File Operation"!!!

5. Simple File Operations

6. a question about the c compiler and the operation system

7. File Operations

8. question on bit operations

9. Bitwise operations - rotating bits of a file

10. Require Help on File operations

11. file operations in MSDOS

12. Problem with file operation.


Powered by phpBB® Forum Software