News:

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

file handle

Started by mdp, May 13, 2006, 03:42:10 AM

Previous topic - Next topic

mdp

how to a=fopen(file,"w"); fprint(a,"test");fclose(a); with MASM ?

hutch--

Hi mdp,

Welcome on board. You could try formatting it like masm code to start with, the trailing C ";" is a comment in MASM so you will need to put each macro command on a seperate line.

LOCAL hFile :DWORD
  ....
mov hFile, fcreate("yourfile.ext")
     ; or
mov hFile, fopen("yourfile.ext")  ; if it already exists

fprint hFile,"Howdy Folks"
fclose hFile
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

mdp

and how to do that, please? :)
thanks

Ar-ras

LOL
hutch wrote everything you need

write the normal masm file structure
put a proc
put the data which posted into the proc
call the proc

mdp

well, I can't find any tutorial about file handling

mdp

can someone give me a small example? please

hutch--

mdp,

The reference for macros of this type are in the helpfle HLHELP.HLP.

I have already posted the working code for you so there is little else I can do for you but you will have to learn how to write some of this stuff, not just ask people to do it for you.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

mdp

thanks hutch, but ...
Assembling: test.asm
test.asm(83) : error A2008: syntax error : fprint
test.asm(84) : error A2008: syntax error : fclose
test.asm(81) : error A2006: undefined symbol : fopen

hutch--

Try posting your TEST.ASM and someone may be able to help you.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Ar-ras

he uses c routines
he should include the lib and the inc.....

mdp

Is posible to use all C stdio.h functions in MASM?

hutch--

Yes but you wil have to write your own prototypes and they will end up a lot larger than using the masm32 macros which are pure API code. You also have another option and that is to use MSVCRT which provides most of this functionality. MSVCRT has direct support in masm32 so you can use the C runtime DLL.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Mark Jones

Quote from: hutch-- on May 14, 2006, 11:05:40 AM
MSVCRT has direct support in masm32 so you can use the C runtime DLL.

Hi Mdp. This is how you "include" the functions from MSVCRT.DLL:


include \masm32\include\masm32rt.inc  ; includes most typical .DLL prototypes and definitions
include \masm32\include\msvcrt.inc
includelib \masm32\lib\msvcrt.lib


Then try your f* functions. Have fun! :bg
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08