Can anyone offer a little assistance?
PB/DLL 6
WinNT 4.0
Pentium II - 400 MHz
I am creating a file and trying to write to it.
I am using the following code.
LOCAL FileNum AS LONG
LOCAL Count AS LONG
LOCAL SecAttrib AS SECURITY_ATTRIBUTES
SecAttrib.nLength = SIZEOF(SecAttrib)
SecAttrib.lpSecurityDescriptor = %NULL
SecAttrib.bInheritHandle = %True
FileNum = CreateFile(FileIO, _
%GENERIC_READ OR %GENERIC_WRITE, _
%FILE_SHARE_READ OR _
%FILE_SHARE_WRITE, _
SecAttrib, _
%CREATE_ALWAYS, %FILE_ATTRIBUTE_NORMAL, %NULL)
This works and return me a file handle.
Next I do this:
LOCAL Buffer AS ASCIIZ * 1024
LOCAL Written AS LONG
LOCAL Result AS LONG
Buffer = "Anything at all" + $NUL
Result = WriteFile(FileNum, Buffer, LEN(Buffer), Written, 0)
This ALWAYS fails. Result = 0 every time.
Am I doing something wrong?
I know this can be done with PB/DLL functions, but I need
to do it this way.
PB/DLL 6
WinNT 4.0
Pentium II - 400 MHz
I am creating a file and trying to write to it.
I am using the following code.
LOCAL FileNum AS LONG
LOCAL Count AS LONG
LOCAL SecAttrib AS SECURITY_ATTRIBUTES
SecAttrib.nLength = SIZEOF(SecAttrib)
SecAttrib.lpSecurityDescriptor = %NULL
SecAttrib.bInheritHandle = %True
FileNum = CreateFile(FileIO, _
%GENERIC_READ OR %GENERIC_WRITE, _
%FILE_SHARE_READ OR _
%FILE_SHARE_WRITE, _
SecAttrib, _
%CREATE_ALWAYS, %FILE_ATTRIBUTE_NORMAL, %NULL)
This works and return me a file handle.
Next I do this:
LOCAL Buffer AS ASCIIZ * 1024
LOCAL Written AS LONG
LOCAL Result AS LONG
Buffer = "Anything at all" + $NUL
Result = WriteFile(FileNum, Buffer, LEN(Buffer), Written, 0)
This ALWAYS fails. Result = 0 every time.
Am I doing something wrong?
I know this can be done with PB/DLL functions, but I need
to do it this way.
Comment