 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Tue May 09, 2006 3:14 am Post subject: to write binary file.... |
|
|
I executed following codes.
but, It's writed by text mode in "text.txt" file.
I want to write by binary....
How......???
---------------------------------------------------
FILE* fp;
_fmode = O_BINARY;
fp = fopen("d:\\text.txt", "wb");
fwrite("abcdefg", 7, 1, fp);
fclose(fp);
---------------------------------------------------
---------------------------------------------------
So sorry...
I know english a little...ㅡㅡ;
--------------------------------------------------- |
|
| Back to top |
|
 |
Eric Guest
|
Posted: Mon May 29, 2006 12:26 pm Post subject: Re: to write binary file.... |
|
|
odnd77 (AT) nate (DOT) com wrote:
| Quote: | I executed following codes.
but, It's writed by text mode in "text.txt" file.
I want to write by binary....
How......???
---------------------------------------------------
FILE* fp;
_fmode = O_BINARY;
fp = fopen("d:\\text.txt", "wb");
fwrite("abcdefg", 7, 1, fp);
fclose(fp);
---------------------------------------------------
---------------------------------------------------
So sorry...
I know english a little...??;
---------------------------------------------------
You say you want to write in binary mode to a file. |
The code you posted does just that.
but the line: "_fmode = O_BINARY;" can be deleted, its meaningless.
I dont see your problem. you wrote 7 characters to a file located
on your d: drive called text.txt and closed the file. What did you expect to
see in the file besides "abcdef"? What makes you think your code didnt work
right?
Eric |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|