Re: I/O: What is the best format? (To CChris [and All])
- Posted by Paulo Fernandes <paulof1953 at gmail.com> Jun 09, 2007
- 519 views
Très bien, CChris. C'est ne pas du problem! When you have a little time to review the translate, go on, s'il vous plaît. Binary files is the response... Ah, yes, and there are another parameter (I didn't remember it), the sixth, *limTol*. And the Procedure MostHora (Function MostHora in Pascal) is working. The code is this way: ------------------------------------------------------------------------ procedure MostHora() sequence s1, s2 integer f9, rc -- TR: files are represented by integer handles -- TR: Eu doesn't know about instruction groups -- begin -- TR: '\' must be escaped in manifest strings, as it is -- the escape character s1 = "C:\\Windows\\System32\\Cmd.exe " s2 = "/C Time < C:\\Enter. > Wrk09.txt" rc = system_exec(s1 & s2,2) -- TR: please refer to the date() and time() commands. -- I don't know if the formats are the same as yours. -- system_exec(s1 & s2,2) -- assign(f9,'Wrk09.txt'); -- reset (f9); f9 = open("Wrk09.txt","r") s2 = gets(f9) s2 = s2[13..13+11-1] -- readln(f9,s1); -- s2: = copy(s1,13,20); -- write(s2); -- TR: 1 is standard output puts(1,s2) close (f9) end procedure ------------------------------------------------------------------------ Now I know that there are the functions date() and time() but I prefer to keep the original function in the same way. A question: the interpreter give me an error message when I declare the variable of a 'loop for'. Is this correct? Thanks a lot! God blessed You! Paulo Fernandes Brasil CChris wrote: > > Paulo Fernandes wrote: > > > > CChris, still about to translate from Pascal to Euphoria: I am sending > > below some possible formats of text files. I would like to know how is > > the best to input data into my variables. The first file (KillCPs.txt) > > could be this format: > > > > UDUDUDUDXXXXUD,3,4,5,10 > > XXXUUDDDUUDXUD,2,3,6,11 > > UDUUUDUDXUDDUD,2,4,4,10 > > XUUUDDDDXXXXUD,3,4,5,10 > > or this one: > > "UDUDUDUDXXXXUD",3,4,5,10 > > "XXXUUDDDUUDXUD",2,3,6,11 > > "UDUUUDUDXUDDUD",2,4,4,10 > > "XUUUDDDDXXXXUD",3,4,5,10 > > or this one: > > UDUDUDUDXXXXUD 3 4 510 > > XXXUUDDDUUDXUD 2 3 611 > > UDUUUDUDXUDDUD 2 4 410 > > XUUUDDDDXXXXUD 3 4 510 > > or this one: > > UDUDUDUDXXXXUD03040510 > > XXXUUDDDUUDXUD02030611 > > UDUUUDUDXUDDUD02040410 > > XUUUDDDDXXXXUD03040510 > > > > The second file (parameter arqEnt) could be like this: > > UDUDUDUDXXXXUD > > XXXUUDDDUUDXUD > > UDUUUDUDXUDDUD > > XUUUDDDDXXXXUU > > UDUDUDUDXXXXUD > > XXXUUDDDUUDXUD > > UDUUUDUDXUDDUD > > XUUUDDDDXXXXUD > > or like this one: > > "UDUDUDUDXXXXUD" > > "XXXUUDDDUUDXUD" > > "UDUUUDUDXUDDUD" > > "XUUUDDDDXXXXUU" > > "UDUDUDUDXXXXUD" > > "XXXUUDDDUUDXUD" > > "UDUUUDUDXUDDUD" > > "XUUUDDDDXXXXUD" > > > > Considering that 5.000.000 records will be read, I should opt which > > format for? Or another, of couse. I am asking because you have made > > a function 'Split' who take time of the computer. Is there some way > > to simplify the data entrance? > > > > Thanks a lot. > > > > Paulo Fernandes > > Porto Alegre/RS > > Brasil > > > > PS: I have discovered the documentation! the EE editor! and the IDE > > Judith (that is not working for now)! It is a new world!! > > <snip> > > In my translation, I tried to respect the initial Pascal record format, > because > I didn't know if you were reusing old files built with this format. > > Now, there are obviously better ways. The simplest - perhaps not the fastest > > though - would be storing your items as > {"XUUUDDDDXXXXUD",3,4,5,10}. Wasn't there a 6th param read into limTol? > Then you could store using sprint(), retrieve using get() and avoid the > need to split(). > Since you appear to use actually fixed size binary data, the best shot > for speed would be to treat your files as binary, since a record has the > same number of bytes. Then you'd use get_bytes() to read and puts() to write. > I may cme up with a revised translation of your program using the above > techniques, but later, this weekend. > > CChris