Re: writing numbers to file

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

From: <dstanger at belco.bc.ca>
> 
> --Scans the colors from {0,0} to {5,5} and writes them to bitmap.dat...
> for y  0 to 4 do
>         data = get_pixel({0,y,5})
>             print(fn, data)
> end for

Try this instead:
 for y =  0 to 4 do
      data = append(data, get_pixel( {0,y,5} )
 end for
 
 That should create a nested sequence, which you print to disk using:

 fn = open( "BitMap.DAT", "w")  
  print(fn, data)
 close(fn)
 
and then read back  as follows:

 fn = open( "BitMap.DAT","r")
  data = get(fn)
  if data[1] = GET_SUCCESS then data = data[2]
  else puts(1,"ERROR")
  end if
 close(fn)

Regards,
Irv

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

Search



Quick Links

User menu

Not signed in.

Misc Menu