Anonymous577154

hi

i'm writing an application where error messages are written into a text file.

text file is created using win32API createfile() function.

after that everytime an error occurs the message is written into the text file with writefile() API.

but whenever a new message is written the old text in the file is getting overwritten.

i want to append the new message at the end of the text already in the file.

can anyone help.

thanks in advance



Re: Visual Basic General win32 API write file() to append text

TaDa

Scrap the API stuff and use a StreamWriter.



Re: Visual Basic General win32 API write file() to append text

Anonymous

but i need to use API . my superiors want me to



Re: Visual Basic General win32 API write file() to append text

cybertaz69

Thats like saing I have a shovel but I'm going to use this spoon instead........

Both can be used to dig the hole but the person using the shovel will be done much faster......






Re: Visual Basic General win32 API write file() to append text

JohnWein

If your superiors want you to use the Win API, then they probably don't want you using .Net. Try the VC++ forums.



Re: Visual Basic General win32 API write file() to append text

Anonymous

like i asked

is there an option where we can append text at the end of file

thanks for any responses





Re: Visual Basic General win32 API write file() to append text

Jung Yi

Hello,

With some study, found this api call

DWORD dwPtr = SetFilePointer( hFile, 0, NULL, FILE_END);

another api

BOOL SetEndOfFile(HANDLE hFile);






Re: Visual Basic General win32 API write file() to append text

Anarchy

replace your superiors, or use your technical savvy to explain to them why they are idiots