BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

to write binary file....

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Tue May 09, 2006 3:14 am    Post subject: to write binary file.... Reply with 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...ㅡㅡ;
---------------------------------------------------
Back to top
Eric
Guest





PostPosted: Mon May 29, 2006 12:26 pm    Post subject: Re: to write binary file.... Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.