News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Text File handler

Started by Farabi, May 08, 2009, 01:45:13 PM

Previous topic - Next topic

Farabi

I upload my text file handler, I dont know what should I call it.
As ussual, its all free, but mentioning or reffering my name to the person which will able to recruit me is appreciated  :green.
Here is a basic use of it,


LOCAL hFile,lc:dword

invoke OpenFileFrb,lpFileName
mov hFile,eax      ; Open A file and map it on the memory, this code is slow, but after it done, everything will be fast
invoke UMLineCount,hFile
mov lc,eax  ; This will do the line counting for you, it will count how many line on your text file
invoke TextFromFile,tcnt,hFile; edx will be the text on tcnt line, and eax wil be the text size in byte, return -1 if line are more on max line count
invoke GetWord,hFile,tcnt,1 ; this will get the word at line pointed by tcnt, and the next parameter is for the position of the word, edx will return an address which is a structure of frbWordStruct
invoke CloseFileFrb,hFile ; Release the memory and close the file





frbWordStruct struc
   nHeader dword 0
   lpAddress dword 0
   nSize dword 0
frbWordStruct ends


I used this function to read my program seting because you cant get any faster to get any line than my TextFromFile function, I bet  :bdg. Unfortunately It cannot insert or add any new line dinamically and I didnot design it to read from memory, but enhancement or speeds up is welcome. :wink

[attachment deleted by admin]
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

UtillMasm

i have downloaded it.
haha, great work! :U

mitchi

The file download doesn't work for me. I only see a 0KB .zip attachment.

Farabi

Mitchi:
Me too. Something must be wrong.
I upload it in here http://omploader.org/vMW42eQ/hNullString.rar
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

mitchi

It works. Much thanks Farabi for sharing your text file handler with us ;)
If it's all your work, you could put your name at the top of the file and maybe comment the function parameters more?

Farabi

Quote from: mitchi on May 08, 2009, 04:32:38 PM
It works. Much thanks Farabi for sharing your text file handler with us ;)
If it's all your work, you could put your name at the top of the file and maybe comment the function parameters more?
Yup its my work. I'll put it someday, but the newer fie on my harddisk is have my name on top of it.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

UtillMasm


Farabi

Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

PBrennick

Seems to be just an include file to me. Am I missing something? Like an executable, for instance? Or am I just desufnoc?

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Farabi

Quote from: PBrennick on May 28, 2009, 12:34:05 AM
Seems to be just an include file to me. Am I missing something? Like an executable, for instance? Or am I just desufnoc?

Paul


The Code is inside the include file, it is my habit to put the code inside it.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

PBrennick

Yeah, well, of course, I saw that but it is not struxctured as a program so I am ..

nevermind.
The GeneSys Project is available from:
The Repository or My crappy website

Farabi

I found some bug at the line counter, fixed.
I upload the new file.

[attachment deleted by admin]
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"