in windows

Windows API: CreateFile


#include <windows.h>
#include <tchar.h>
#include <stdio.h>


int main(int argc, char* argv[]) {

	HANDLE myFile; //create a handle which is a pointer named myFile
	myFile = CreateFile(_T("C://Users//rob//Dropbox//testfile.txt"),
		GENERIC_READ | GENERIC_WRITE, //DesiredAccess
		0,							  //sharemode 0 means if file is created the file cannot be shared 
		NULL,						  //SecurityAttributes
		CREATE_NEW,					  //CreationDisposition
		FILE_ATTRIBUTE_NORMAL,		  //FileAttributes
		NULL						  //TemplateFile
	);

	if (myFile == INVALID_HANDLE_VALUE) {
        printf("Error could not write file: %u",GetLastError());
		return -1;
	}
	else {
		printf("Yay we created a file");
	}

	return 0;
}