1. Another doubt about reading/writing files...
- Posted by Ricardo Niederberger Cabral <rnc at INFOLINK.COM.BR> Sep 07, 1996
- 1191 views
Here I am with another doubt: I would like to save a 2D array (a sequence of sequences) that I initialized like this: MapVar = repeat(repeat({0, 0}, 100), 100) in a data file (could be binary or whatever...) so I can read it later. How can I do it using Euphoria ? Thanks, --- Ricardo Niederberger Cabral Command & Conquer World: Files, Links, Tactics, News ... http://www.geocities.com/TimesSquare/1210
2. Re: Another doubt about reading/writing files...
- Posted by Lucius L Hilley III <luciuslhilleyiii at JUNO.COM> Apr 03, 1997
- 1178 views
On Sat, 7 Sep 1996 19:53:14 -0300 Ricardo Niederberger Cabral <rnc at INFOLINK.COM.BR> writes: > >I would like to save a 2D array (a sequence of sequences) that I >initialized >like this: > MapVar = repeat(repeat({0, 0}, 100), 100) >in a data file (could be binary or whatever...) so I can read it >later. How can I do it using Euphoria ? > integer handle handle = open("file", "w") MapVar = repeat(repeat(0, 320), 200) print(handle, MapVar) close(handle) You really should use the help files. I got this info by loading the editor. Pressed ESC h l Escape for menu h for help l for library Pressed ESC f f for find Typed in print Read some then Pressed ESC f Typed in <print Boom I had the info I needed. The documentation is actually done rather well. Good luck. --Lucius Lamar Hilley III -- E-mail at luciuslhilleyiii at juno.com -- I support transferring of files less than 60K. -- I can Decode both UU and Base64 format.
3. Another doubt about reading/writing files...
- Posted by Ad Rienks <Ad_Rienks at COMPUSERVE.COM> Apr 03, 1997
- 1182 views
3/4/97 17:57, you wrote: >Poster: Ricardo Niederberger Cabral <rnc at INFOLINK.COM.BR> >Subject: Another doubt about reading/writing files... >-------------------------------------------------------------------------- ----- > Here I am with another doubt: >I would like to save a 2D array (a sequence of sequences) that I initialized >like this: > MapVar = repeat(repeat({0, 0}, 100), 100) >in a data file (could be binary or whatever...) so I can read it later. How >can I do it using Euphoria ? >Thanks, >--- >Ricardo Niederberger Cabral Hi Ricardo, The simplest way to write and read a sequence is the following: include file.e --------------------------------------------------------------------------- ------------ procedure save_data() integer file file = open("MapVar.dat", "w") -- open for writing if file = -1 then puts(1, "Unable to open file!") abort(1) else print(file, MapVar) -- 'print' is the easiest form of writing to files close(file) end if end procedure -- save_data --------------------------------------------------------------------------- ------------ procedure load_data() integer file object input file = open("MapVar.dat", "r") -- open for reading if file = -1 then puts(1, "Unable to open file!") abort(1) else input = get(file) -- 'get' is the opposite of print if input[1] = GET_SUCCESS then -- succesfully loaded? MapVar = input[2] -- put it in your sequence end if close(file) end if end procedure -- load_data --------------------------------------------------------------------------- ------------ Hope this helps --------------------------------------------------------------------------- ------------ Ad Rienks AdRienks at compuserve.com
4. Re: Another doubt about reading/writing files...
- Posted by Architek <architek at GEOCITIES.COM> Apr 03, 1997
- 1189 views
- Last edited Apr 04, 1997
Lucius L Hilley III wrote: > The documentation is actually done rather well. If you want you can get the version 1.4b documentation in windows .hlp format from my homepage. Or download the windows editor from RDS homepage, it includes the version 1.5 docs in winhelp format too. Enjoy Euphoria! -- ************************************ This message sent by Daniel Berstein ************************************ email: architek at geocities.com homepages: http://www.geocities.com/SiliconValley/Heights/9316 http://www.cybercity.hko.net/silicon_valley/architek