KEYWORD PUT

Anything QL Software or Programming Related.
Post Reply
qbits
Trump Card
Posts: 173
Joined: Sun Dec 11, 2016 3:32 pm

KEYWORD PUT

Post by qbits »

Can someone explain what I’m doing wrong? Or what is happening!
Attachments
KETWORD PUT.jpg
KETWORD PUT.jpg (19.4 KiB) Viewed 534 times


User avatar
janbredenbeek
Super Gold Card
Posts: 633
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: KEYWORD PUT

Post by janbredenbeek »

qbits wrote: Thu Aug 24, 2023 12:44 pm Can someone explain what I’m doing wrong? Or what is happening!
PUT stores data in its internal form in a file, while PRINT stores it in the form as it is printed on the screen.

An integer variable is 2 bytes, a floating point variable 6 bytes and a string 2 bytes (the length) followed by the bytes of the string itself.

So PRINT#9;"Hello" prints the characters "Hello" followed by an EOL (LF) character to #9
and PUT#9;"Hello" prints the bytes 0, 5, and "Hello" (without LF!) to #9.


Derek_Stewart
Font of All Knowledge
Posts: 3975
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: KEYWORD PUT

Post by Derek_Stewart »

Hi,

I always have problems with PUT, I generally use BPUT to handle bytes inserted into a file or channel.


Regards,

Derek
qbits
Trump Card
Posts: 173
Joined: Sun Dec 11, 2016 3:32 pm

Re: KEYWORD PUT

Post by qbits »

Hi,
Thanks janbredenbeek I sort of remembered about the size of Str$ thing but your comments help switch the light back on.
That helped me get to where I wanted. My problem is now solved.

QBITS


Post Reply