Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 1.16 KB

sample_015.md

File metadata and controls

49 lines (33 loc) · 1.16 KB

Home

Creating a file, then moving it to another destination

Before you begin:

See also:


Code:

#DEFINE CREATE_ALWAYS 2
#DEFINE FILE_ATTRIBUTE_NORMAL 128

DO declare

lpFileName = "C:\Temp\mytest.txt"
lpNewFileName = "C:\Temp\mytest1.txt"

hFile = CreateFile(lpFileName, 0, 0, 0,;
	CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0)

? "File handle returned:", hFile
= CloseHandle (hFile)
= MoveFile(lpFileName, lpNewFileName)

PROCEDURE declare
	DECLARE INTEGER MoveFile IN kernel32;
		STRING lpExistingFileName, STRING lpNewFileName

	DECLARE INTEGER CreateFile IN kernel32;
		STRING lpFileName, INTEGER dwDesiredAccess,;
		INTEGER dwShareMode, INTEGER lpSecurityAttributes,;
		INTEGER dwCreationDisposition,;
		INTEGER dwFlagsAndAttributes, INTEGER hTemplateFile

	DECLARE INTEGER CloseHandle IN kernel32 INTEGER hObject  

Listed functions:

CloseHandle
CreateFile
MoveFile