TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Keith Fowler
from: John Gardeniers
date: 1996-04-01 20:56:32
subject: Re: Structures and Binary

-=> On 29 Mar 96  18:08:46 Keith Fowler articulated to All <=-

        Hello Keith,

 KF> Hello everyone, could some body please help me.. I'm trying to
 KF> write a  structure to a file, but i can't get it to write it.. I've

        I don't think you can write a structure using a single command, or
at least you can't with the compiler I use.  I think your best bet would be
to to write a routine to convert the data in your structure to something
else and write that to your file.  To work out what format would be best I
would suggest you work backwards.  i.e.  Work out what format would be the
easiest to read back in, as it doesn't make a lot of programming difference
what format you write.

 KF> And also.. How do i open a file in BINARY mode to write to?? (if
 KF> the file  is in TRUE binary when you edit it with say, XTree Gold, it
 KF> should say  something like : CANNOT EDIT NON-TEXT FILE .... I have
 KF> tried: writepoint = fopen("record.dat","wb");
 KF> but it just writes the file in text mode... Any help would be

        You may possibly misunderstand the difference between binary and
text files (or else _I'm_ confused!).  A text file is terminated by a
CTRL-Z (ascii 26), a binary file isn't.  If a binary file is opened in text
mode the reading program will think it's found the end of file marker the
first time it comes across a byte with a value of 26, which is of course a
perfectly valid character in a binary file.

        If you write text to a binary file the reading program will still
treat it as text.  Normally programs such as XTree, List, NC, etc.  only
worry about the actual characters read.  i.e.  Provided all characters are
valid text characters the program won't give you an error message, such as
the one you quoted.

        Hope I haven't added to your confusion.

                John

... If at first you don't succeed, try something else.
---
* Origin: Melbourne PC User Group +61-3-9699-6788 (3:632/309)
SEEN-BY: 50/99 78/0 620/243 623/630 632/0 107 271 304 309 328 348 360 393 525
SEEN-BY: 632/530 552 998 999 1000 633/371 634/384 388 396 635/301 502 503 544
SEEN-BY: 637/103 639/252 670/301 711/401 409 410 413 430 808 809 932 934
SEEN-BY: 712/515 713/888 714/906 800/1 7877/2809
@PATH: 632/309 998 635/503 50/99 711/808 809 934

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™.