Readline

Report any Hollywood bugs here
Post Reply
User avatar
lazi
Posts: 625
Joined: Thu Feb 24, 2011 11:08 pm

Readline

Post by lazi »

The documentation says that ReadLine stops at a linefeed or at the end of the file.
Tried it on a file which has a $0D for linefeed but that does not stopped ReadLine. (OS4)

The file content starts like this:
Image

Here is the script:

Code: Select all

OpenFile(1,"ram:pdf.pdf")
a=ReadLine(1)
DebugPrint(HexStr( StrLen(a)))
DebugPrint(a)
CloseFile(1)    
And the result:

Code: Select all

10.RAM Disk:> hollywood Unnamed.hws 
$D3
%PDF-1.31 0 obj<</Type /XObject /Subtype /Image /Name /Im1 /Width 1654 /Height 2338 /Length 174931/ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter [ /DCTDecode ] >> streamÿØÿà
10.RAM Disk:>  
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Readline

Post by airsoftsoftwair »

That's not a bug because $0D is not a linefeed but a carriage return. See here:
https://en.wikipedia.org/wiki/Newline

ReadLine() just ignores all CR characters because usually there is a CRLF (Windows format) or just a LF. Using just a CR for a newline is pretty exotic. I think this was used on the C64 and old Apple systems. Maybe that's why PDFs still have this...
Post Reply