[Gambas-user] Read a binary file

Oliver Etchebarne Bejarano oliver at ...2681...
Mon Sep 19 20:48:54 CEST 2011


Hah! That's the function I was looking for :-D

Thank you Benoît!!!!!!

  /Oliver Etchebarne Bejarano/
  Gerente General
  *Paperclip X10 SRL*
================================================
Web      :http://x10.pe  <http://x10.pe/>
Feed RSS :http://x10.pe/feed
Facebook :http://x10.pe/facebook
Twitter  :http://x10.pe/twitter
YouTube  :http://x10.pe/youtube
================================================


El 18/09/11 07:47, Benoît Minisini escribió:
>> Hi everyone
>>
>> I'm doing a little webserver in Gambas. Everything is ok so far, but I'm
>> having a hard time dealing with binary files (like images). Is there a
>> way to read a file in a raw fashion?
>>
>> I've tried to do an OPEN file FOR READ, and using a "byte" variable as
>> buffer. But the bytes are read in this orden: 1, 0, 3, 2, 5, 4, 7, 6,
>> etc... I think it's something about the endiannes.
>>
>> Again, there is a way to read a file without any format constraints?
>> Thank you!!!!
> If you want to serve some image files, you don't have to read it byte by byte.
> You just have to open it and sent it where it is needed.
>
> Print #DestinationFileOrSocket, File.Load(PathToBinaryFileOnTheServer);
>
> Do not forget the ";", otherwise a newline will be added!
>



More information about the User mailing list