flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
miksayer
How can I to read from text file?
|
|||
![]() |
|
afw2004
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 |
|||
![]() |
|
miksayer
afw2004, thank you!
|
|||
![]() |
|
Vasilev Vjacheslav
i'd recommend you to use pure windows api (CreateFile, ReadFile, CloseHandle)
|
|||
![]() |
|
rwalt
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 |
|||
![]() |
|
Tomasz Grysztar
Actually it's the other way round. Also, you will not find the MSVCRT functions in the Microsoft's Win32 API reference.
|
|||
![]() |
|
miksayer
Quote:
why? |
|||
![]() |
|
rwalt
Yes, your correct, I should have held back on my reply.
![]() _________________ DarkStar |
|||
![]() |
|
Reverend
miksayer wrote:
But you can find all needed info in C/C++ reference (just as: www.msdn.com) |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.