TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Keith Fowler
from: Paul Edwards
date: 1996-04-05 21:27:20
subject: Structures and Binary

PE> After opening the file as above, try going fputc(0x01, writepoint);
PE> and then close the file, and see what Xtree thinks of it then. You
PE> see, you actually have to write some binary data to a binary file
PE> before it starts looking like a binary file!  If you only write
PE> printable text to a binary file, it will look just like a text file!
PE> BFN.  Paul.

KF>        Hello Paul, I did what you said, but when you view it in XTreeGold 
KF> there is nothing in the file (theres stuff in it but you can't see it, and 
KF> the size of the file is 1 byte), then when you edit it it will edit it, and 
KF> it does not come up and say cannot edit non-text file, it just edits it, 
KF> and the only thing in the file is a happy face :-)... any ideas??. What i 
KF> mean is like if the file is a TRUE binary, when you view it in XTree Gold, 
KF> you get
KF> 000000 textúúúú etc etc... but with
writepoint=fopen("record.dat",wb"); it 

As someone else suggested, it might be looking at the filename.  Change
"record.dat" to "junk.exe".

KF> just don't go...  (i also repeated your command and just got more happy 
KF> faces), thanks for ya help though, got any more commands to try?? :-)..

Ok, try:

int x;

for (x=0; x < 256; x++) fputc(x, writepoint);

If that doesn't create a binary file, nothing will.

KF>        And, if you have to write binary data to a file, how can you write a 
KF> line of normal text to a binary file?.. Cya!

Same way as usual:

fputc('A', writepoint);
fprintf(writepoint, "Hello there number %d\n", 57);
fputs("JJJeans it's a warehouse warehouse", writepoint);

BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.