flat assembler
Message board for the users of flat assembler.
Index
> Windows > Reading from text file |
Author |
|
miksayer 14 Jul 2005, 21:07
How can I to read from text file?
|
|||
14 Jul 2005, 21:07 |
|
afw2004 15 Jul 2005, 10:01
If you are writing program for Windows, you can use function from msvcrt.dll library. For example:
Code: READ_ACCEDD db 'r',0 proc read_text_file, .pszFileName local .tfile:dword, .pStrBuf:dword push ebx edi esi invoke LocalAlloc, LMEM_FIXED or LMEM_ZEROINIT,1024 ; Allocate space for string to read mov [.pStrBuf],eax cinvoke fopen, [.pszFileName],READ_ACCESS ; Open text file for reading mov [.tfile],eax .startloop: ; Get string from text file one by one and store it in [.pStrBuf] cinvoke fgets, [.pStrBuf],1024,[.tfile] test eax,eax jnz .startloop cinvoke flose, [.tfile] invoke LocalFree, [.pStrBuf] pop esi edi ebx ret endp |
|||
15 Jul 2005, 10:01 |
|
miksayer 15 Jul 2005, 10:04
afw2004, thank you!
|
|||
15 Jul 2005, 10:04 |
|
Vasilev Vjacheslav 15 Jul 2005, 19:50
i'd recommend you to use pure windows api (CreateFile, ReadFile, CloseHandle)
|
|||
15 Jul 2005, 19:50 |
|
rwalt 16 Jul 2005, 04:18
MSVCRT.DLL is a part of the Microsoft Win32 API. It is not one of the core libraries, but it is a member of the API. I believe also that CreateFile and ReadFile may actually make calls to some of the file handling procedures in the C runtime libraries.
_________________ DarkStar |
|||
16 Jul 2005, 04:18 |
|
Tomasz Grysztar 16 Jul 2005, 10:21
Actually it's the other way round. Also, you will not find the MSVCRT functions in the Microsoft's Win32 API reference.
|
|||
16 Jul 2005, 10:21 |
|
miksayer 16 Jul 2005, 16:02
Quote:
why? |
|||
16 Jul 2005, 16:02 |
|
rwalt 19 Jul 2005, 04:41
Yes, your correct, I should have held back on my reply.
_________________ DarkStar |
|||
19 Jul 2005, 04:41 |
|
Reverend 19 Jul 2005, 23:49
miksayer wrote:
But you can find all needed info in C/C++ reference (just as: www.msdn.com) |
|||
19 Jul 2005, 23:49 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.