realbasic-betas.mbox
[Top] [All Lists]

Re: [OFF] sending base64 encoded image data to browser (was stdout.write

To: REALbasic Betas <realbasic-betas at lists dot realsoftware dot com>
Subject: Re: [OFF] sending base64 encoded image data to browser (was stdout.write broken?)
From: Andrew Bush <andrew dot bush at xtra dot co dot nz>
Date: Tue, 27 Jul 2004 23:16:57 +1200
Delivered-to: realbasic-betas at lists dot realsoftware dot com

Hi Frank,

Could this be an encoding problem? Is there a workaround known to man? Because if not, you can't work with xinetd, as it seems...


its not an encoding problem as such, just a pretty basic fact of life that printf looks for various escape chars to format its output, and also responds to the standard c null char etc....which means that binary data is going to cause some odd results.

luckily theres a pretty easy workaround :)

Im not sure how it compares in speed....I dont seem to be able to find a c output command for that doesn't attempt to apply some kind of formatting, does anyone have any suggestions?

putchar is part of the stdio library and should be available for you on both linux and windows as well if you need it there.


Protected Sub putString(theString as string)
   #pragma disableBackgroundTasks
   dim i as integer
   for i=1 to lenb(theString)
      me.putchar(midb(theString,i,1))
   next
End Sub

Protected Sub putchar(theChar as string)
   #pragma disableBackgroundTasks
Declare function putchar lib "/usr/lib/libc.dylib" (char as integer) as integer
   dim result as integer
   if me.m=nil then
      me.m=newmemoryBlock(4)
   end if
   m.cstring(0)=theChar
   result = putchar(m.Byte(0))
End Sub

HTH

Yours cheerfully,


        Andrew Bush




_______________________________________________
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>