Re: Writing To Binary File

new topic     » goto parent     » topic index » view thread      » older message » newer message
ghaberek said...

The print() routine outputs a plain-text, semi-human-readable representation of a Euphoria object. If you're writing files in binary mode, you should be puts()-ing a sequence of bytes to the file. Typically, when you're using binary mode, you'll be using some sort of defined file structure, either an existing format (like an image or a document), or your own custom layout (like EDS). If you want to print() object to a file, then use text mode and later read them back with get().

-Greg

OK, I'm getting a little bit more of it, but my code still returns an error whenever I try to run it. It dosen't function correctley. Here's what I'm trying to do.

integer fn 
fn = open("sav.frst","wb") 
if fn = -1 then then 
   puts(1,"Cannot write file!\n") 
  else 
      wPrint(fn,HP) 
end if 

However when whenver I do that, my program crashes with a console window comes up and has a bunch of errors in it, also I'm using the win32lib, so I am wondering what I am doing wrong

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu