[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Encode <0>
> My source code is :
> begin-report
> encode '<0>' into $pp
> print $pp (,)
> end-report
>
> Do I make a mistake ?
> Is there another way to put '<0>' into my output file ?
>
No, you are doing the right thing, but it won't work.
The problem is that SQR uses 0-terminated strings internally. So, when you
encode a 0, the string handling routines treat that as an end-of-string
marker and truncate the string at that point.
I know of two work-arounds for this problem. One is to write an external
routine that does what you need and then link that into SQR. (See UCALL and
UFUNC in the SQR manual for more information.)
The other is to choose some other character to act as a placeholder and then
run a filter on the output file after SQR writes it. For example, you could
output a # where ever you needed a 0, and then run (on Unix) something like
"tr '#' '\0'" on the output file. (Note that not all version of tr can
handle 0s.) You can even fire off the tr command (or whatever) from within
SQR with a "call system using" command.
Hope this helps.
Nathan
----------------------------------------------------------------------------
Nathan Treadway | Ray Ontko & Co. | info@ontko.com (auto-reply server)
nathant@ontko.com | Richmond, IN | ftp.ontko.com, http://www.ontko.com/
- References:
- Encode <0>
- From: "Stephane Rognon (ok)" <rognon@ELYSEES.FINACOR.FR>