Re: confused abt file operations
- From: "Peter Nilsson" <airia@xxxxxxxxxxx>
- Date: 30 Aug 2005 22:30:30 -0700
siliconwafer wrote:
> Hi Again,
> So what about numbers wirtten to /read from the text/binary files?
If you're replying to something specific, please include the context
of what you are replying to.
> I read that in text files numbers are stored as characters or
> strings rather than their actual values. So a number 1234 will
> occoupy 5 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?
With text files, you can only output 'printable' characters. With
binary files you can output whatever byte values you want.
How you encode your integer as output is up to you. For instance,
you can print the number 42 as "42", or "2A" if you want to output
hexadecimal.
Because binary streams are not limited to printable characters
alone, you have an additional option of copying the integer
representation itself.
--
Peter
.
- References:
- confused abt file operations
- From: siliconwafer
- Re: confused abt file operations
- From: Gordon Burditt
- Re: confused abt file operations
- From: Peter "Shaggy" Haywood
- Re: confused abt file operations
- From: siliconwafer
- confused abt file operations
- Prev by Date: Re: while (1) vs. for ( ;; )
- Next by Date: memset doubt
- Previous by thread: Re: confused abt file operations
- Next by thread: Re: confused abt file operations
- Index(es):
Relevant Pages
|