[Gambas-user] pb loading an picture into a string

Jean-Yves F. Barbier 12ukwn at ...626...
Thu Nov 26 13:32:44 CET 2009


Hi,

Here is a (very big) PB:

...
  ' Get picture /path/name.ext
  INfile = FileChooser1.SelectedPath
  
  FileSize = Stat(FileChooser1.SelectedPath).Size
  
  ' Read file into a string
  INstream = OPEN INfile FOR INPUT 
'  READ #INstream, INstring, Lof(INstream)	' NA: Returns 238 bytes
  READ #INstream, INstring, FileSize		' Erk: same thing :(
  CLOSE #INstream
PRINT "INstring length (Len, String.Len) = " & Len(INstring) & " - " & String.Len(INstring)

Returns "298 - 234" when I read a small picture.png file!??
How could I correctly read this image wothout any loss?

Purpose is to read it correctly, convert it to base64 and send it to a postgresql
procedure (and, of course, the opposite.)

JY
-- 
For a man to truly understand rejection, he must first be ignored by a cat.




More information about the User mailing list