Re: confused abt file operations
- From: SM Ryan <wyrmwif@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 31 Aug 2005 08:05:18 -0000
"siliconwafer" <spdandavate@xxxxxxxxx> wrote:
# Hi Again,
# So what about numbers wirtten to /read from the text/binary files?
# I read that in text files numbers are stored as characters or strings
# rather than their actual values.So a number 1234 will occoupy5 bytes(4
# + ' \0 ' ).In binary files,numbers are stored as actual values i.e 1234
# is stored as 2 bytes integer and so on..
# was the book correct?
You can write an arbitrary byte string to text or binary files, and you
can write ASCII (or EBCDIC or UTF16) strings to text or binary files.
Depending on your system, it might end convert some bytes in text mode.
There is nothing that will reach out and smack your C program, though
it might smack some of the bytes going out. It really is system specific.
If you stick to text mode with isprint() characters together with "\n"
and "\t", and don't assume fseek/ftell are byte offsets, you should
be compatiable with all other plain text processing programs on your
machine, and any other system with the same character set and character
encoding. There will also be character set convertors available.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
Elvis was an artist. But that didn't stop him from joining the service
in time of war. That's why he is the king, and you're a shmuck.
.
- References:
- Re: confused abt file operations
- From: siliconwafer
- Re: confused abt file operations
- Prev by Date: Re: while (1) vs. for ( ;; )
- Next by Date: Re: Why C/C++ errors are SO obscure/devious??
- Previous by thread: Re: confused abt file operations
- Next by thread: Re: confused abt file operations
- Index(es):
Relevant Pages
|