Computing.Net > Forums > Programming > read a text file in assembly

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

read a text file in assembly

Reply to Message Icon

Name: AmirHossein
Date: November 18, 2008 at 10:20:56 Pacific
OS: vista bu
CPU/Ram: 2.4g 3m 3g
Comment:

Hi all,
What should I do to read a simple text file in assembly?
should I use interrupts in such a program?
I know that by 'import' you can use another code in another file. but for text, no!



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: November 18, 2008 at 12:39:10 Pacific
Reply:

I don't know the assembler API for Windows systems, but I can assure you have no need to set up an interrupt driven code to accomplish a so easy task. Just refers to the API calls to open and read a text file, the simplest of archives.


0

Response Number 2
Name: chao
Date: November 18, 2008 at 15:47:02 Pacific
Reply:

The "assembler API" for Windows is generally the same one C programs use -- though there are often two versions of any function that touches strings (an ANSI (8-bit) and a Wide (utf-16) version). For instance, there's a MessageBoxA and MessageBoxW. (C hides this little detail with macros.)

Semi obviously, since you're not using C, the C library probably isn't automatically available to you. However, if you have an assembler or linker that knows how to read DLL and EXE files, or have inc files that declare the functions within, you can probably link with msvcrt.dll and use that...

Or, you could just use the Windows functions. The API has functions for just about everything Windows lets you do. Look in MSDN for functions like CreateFile and ReadFile. :) Just mind your calling conventions; Windows usually prefers to clean up its own stack (see this description of Windows calling conventions), and keep in mind that the "standard" (__stdcall) convention is what most of the API uses. Hence the name. :)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: read a text file in assembly

read text file in c to char pointer www.computing.net/answers/programming/read-text-file-in-c-to-char-pointer/7074.html

Reading from a text file in C++ www.computing.net/answers/programming/reading-from-a-text-file-in-c/8983.html

Sort a text file in VBScript www.computing.net/answers/programming/sort-a-text-file-in-vbscript/7334.html