TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Richard Stack
date: 1995-11-14 13:16:36
subject: Problem with WinSetFilePtr

I having a problem with the following code. The first time it's run
 the file is created and the file is written to disk. However, the second
 time the first file is overwritten. No error messages. Checking it with 
 the debugger I find that DosSetFilePtr causes an exception and it doesn't
 execute. So in effect the file pointer is not advanced to the end. DosOpen
 returns 0 and ulAction = FILE_EXISTED. I can't figure out what wrong
 with DoSetFilePtr? Any suggestions?

Regards,
Richard

/* error checking removed */
LONG lDistance = 0;
PULONG pNewPtr;
rc1 = DosOpen (pchFile, &hFileHandle, &ulAction, 0, FILE_NORMAL,
                OPEN_ACTION_OPEN_IF_EXISTS | 
                OPEN_ACTION_CREATE_IF_NEW,
                OPEN_ACCESS_READWRITE | 
                OPEN_SHARE_DENYREADWRITE |
                OPEN_FLAGS_RANDOM, NULL );
rc2 = DosSetFilePtr (hFileHandle, lDistance, FILE_END, pNewPtr); // Move
pointer to end rc3 = DosWrite ( hFileHandle, (PVOID)&ClientData, sizeof
(ClientData), &ulWritten);DosClose (hFileHandle);


--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)
SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 517 628 713/888 800/1 7877/2809
@PATH: 259/414 400 99 250/99 3615/50 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.