1. Hex writing
- Posted by Caballero Rojo <pampeano at ROCKETMAIL.COM> Apr 23, 2000
- 370 views
Hello all, I want to write hex numbers to a file instead of using strings because I have to write hex numbers like 00h that can't be represented on a string, or I don't know how. I use: printf(id,"%s",{#4C,#00,#00,#00}) But that prints only the L character. Can anybody help in this? -- Best regards, ICQ Number: 3198249 Caballero Rojo mailto:pampeano at rocketmail.com __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com
2. Re: Hex writing
- Posted by Bernie Ryan <xotron at BUFFNET.NET> Apr 23, 2000
- 353 views
On Sun, 23 Apr 2000 17:19:54 -0300, Caballero Rojo <pampeano at ROCKETMAIL.COM> wrote: >Hello all, > I want to write hex numbers to a file instead of using strings > because I have to write hex numbers like 00h that can't be > represented on a string, or I don't know how. > I use: printf(id,"%s",{#4C,#00,#00,#00}) > But that prints only the L character. > Can anybody help in this? Because printf is trying to print a null terminated string. The character following #4C "L" is a zero termination amd is understood by printf to represent the end of a string. If you want to print the numeric value you would have to use %d ( decimal ) or %x ( hex ). Bernie
3. Re: Hex writing
- Posted by Bernie Ryan <xotron at BUFFNET.NET> Apr 23, 2000
- 373 views
Forget what I said about null terminated string I am thinking in wrong langauge. The #0 are not printable characters, You have to use %x or %d to print numbers. Bernie
4. Re: Hex writing
- Posted by "Lucius L. Hilley III" <lhilley at CDC.NET> Apr 23, 2000
- 366 views
> ---------------------- Information from the mail header ----------------------- > Sender: Euphoria Programming for MS-DOS <EUPHORIA at LISTSERV.MUOHIO.EDU> > Poster: Bernie Ryan <xotron at BUFFNET.NET> > Subject: Re: Hex writing > -------------------------------------------------------------------------- ----- > > Forget what I said about null terminated string I am thinking > in wrong langauge. > > The #0 are not printable characters, You have to use %x or %d > > to print numbers. > > > Bernie > #00 is not a SCREEN printable character. However, it prints just fine to a file. Example: integer id id = open("temp.tmp", "wb") --printf(id,"%s",{#4C,#00,#00,#00}) printf(id,"%s",{{#4C,#00,#00,#00}}) Yours is commented. Yours will only print the first character. Mine should print the whole string. Yours only printed the first character because it assumes that you have a sequence of strings. Lucius L. Hilley III lhilley at cdc.net +----------+--------------+--------------+ | Hollow | ICQ: 9638898 | AIM: LLHIII | | Horse +--------------+--------------+ | Software | http://www.cdc.net/~lhilley | +----------+-----------------------------+