[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Reading Binary files
Bill,
You are doomed to failure. If you want to read binary data,
use a numeric variable to read byte by byte.
move '' to $s
move 0 to #i
while #i < 9559
read #In into #byte:1
! process the byte. For example:
do byte_to_bitstring( #byte , $bit_string ) ! you'll have to write this
concat $bit_string with $s
add 1 to #i
end-while
Ray
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hello SQR gurus! I hope someone can help....
>
> We are using SQR 4.3.4.
>
> I'm having difficulty in reading a binary file, which is a PCL image file,
> into a string variable. I've opened the file with a record-length of 9559
> (the # of bytes in the file) and set the record type as FIXED_NOLF:
>
> open 'P:\BILL\SQR\HR\ICCLOGO2.PCL' as #In for-reading
> record=9559:fixed_nolf
> status=#InStatus
>
> Now when I READ the file:
>
> READ #In into $ICCLogo:9559
>
> I only get the first 19 bytes of the file (up to the first NULL byte). Is
> there any way to get the entire file into a single string variable? Or is
> this plan doomed to failure? TIA!!!
> --
> William Beckner -- Stunt Programmer (Just call me "Bill")
> Illinois Central College, Rm L141 -- East Peoria, IL 61635-0001
> PH: (309) 694-8419 -- FAX: (309) 694-8995
> "C code. C code run. Please, code, RUN!"
>
----------------------------------------------------------------------
Ray Ontko rayo@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788
Ray Ontko & Co. Software Consulting Services http://www.ontko.com/