Reading and writing files
- Posted by Jesus Consuegra <jconsuegra at REDESTB.ES> Jun 09, 1998
- 580 views
Dear Euphorians: Apologies for the spelling of Thermometer. Now I know the "h" is in front of the first "e". (In my discharge, I have to say that in Catalan and Spanish is "Termòmetre" and "Termómetro", and I cannot remember how is spelled in French, but I would spell it "Termomêtre" as well, without any "h"..). It will be fixed in the next version of (now) WinTher... I also promise to get a decent english-speller interfaced to my e-mail program... (I knew "bound", but I put "binded" -the wrong regular form- because when thinking on technical issues, the right side of the brain takes control over...). Apologies for any unintended misuse of your (for me) foreign languages. Going technical: ( grammatical mistakes allowed As a matter of progress, I'm trying to implement a basic bitmap resource toolkit, based on the crunching routines of Graeme, just to save/recover crunched bitmaps (to save disk and executable space). Everything looks fine, but when I save a compressed bitmap and I try to read it back, I get a shorter sequence. I'm sure I misunderstand file access, so I would appreciate some help. What I do is: sequence iBmp, oBmp, path outfile = open("test.gcb", "wb") path=input("\n\nEnter .BMP path:") iBmp=read_bitmap(path) l=length(iBmp[2])*length(iBmp[2][1]) pal=iBmp[1] oBmp=crunch(iBmp[2]) puts(outfile,oBmp) close(outfile) -- and afterwards I try to read it back to iBmp, a differenet sequence to be able to compare infile = open("test.gcb", "rb") iBmp = {} line = gets(infile) while (atom(line)) do iBmp = append(iBmp, line) line = gets(infile) end while -- at this point I've been forced to add the following line, to get the sequence in the same format: iBmp = iBmp[1] -- why? -- but iBmp is shorter than oBmp. iBmp is at most 99 bytes... -- What i'm doing wrong?. Thanks. Jesus.