Questions tagged [createfile]

The Windows CreateFile API function

The Windows CreateFile API function.

Use this tag only in conjunction with the windows-specific API. Do not use this tag if you intend to refer to the generic concept of referring to a file.

474 questions
6
votes
2 answers

GENERIC_ALL and folder/file ACLs? What does GENERIC_ALL really do?

I recently redesigned the security on a file server of ours, marking most of what was Full Control to be Modify. Now my developers are telling me that whenever they use GENERIC_ALL to open a file (with CreateFile() for instance), they receive an…
brandeded
  • 2,080
  • 6
  • 25
  • 52
5
votes
3 answers

Machine retains file exists/locks on client-side power outage

Our app running on client server A and creates a file on the server 2008 R2 file-server using: CreateFile(LockFileName, GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ, nil, CREATE_ALWAYS, …
Sam Cogan
  • 4,124
  • 7
  • 44
  • 76
5
votes
1 answer

What does FILE_FLAG_POSIX_SEMANTICS do?

I'm aware that FILE_FLAG_POSIX_SEMANTICS allows for case sensitivity in file names, but the fact that it wasn't named FILE_FLAG_CASE_SENSITIVE makes me think it might be doing more than that. Does it do anything else, or am I analyzing this too…
user541686
  • 205,094
  • 128
  • 528
  • 886
5
votes
2 answers

atomic file creation on Linux?

I need to create a file if it does not exist, in a way that another process trying to create this file would fail. I need the file be considered "created" even before the creating process finished writing the actual data to it. I read about O_EXCL…
davka
  • 13,974
  • 11
  • 61
  • 86
5
votes
1 answer

Read lines from file async using WINAPI ReadFile

I need to read several lines from file simultaneously, i.e. asynchronously. Lines in file are of the same size. For instance, I need to read the second and the fourth lines of file to separate variables or to an array. I'm more used to c#'s…
Denis Yakovenko
  • 3,241
  • 6
  • 48
  • 82
5
votes
1 answer

CreateFile() Serial Communication Issue

I am trying to do some serial communication through my usb port (named COM15), and I am getting an error. This is the code where the error is occurring: HANDLE myPortHandle = CreateFile("COM15", GENERIC_READ |…
CodeBlocks
  • 233
  • 3
  • 5
  • 14
5
votes
1 answer

File.CreateText - Access Denied

I recently spent a while trying to figure out what permissions were needed to get this statement to work: if (!File.Exists(path)) { // Create a file to write to. using (StreamWriter sw = File.CreateText(path)) { …
Talon
  • 3,466
  • 3
  • 32
  • 47
5
votes
2 answers

Create a file in a directory using Perl

How can I create a new file, in which I intend to write in a existing directory using open() in Perl? I tried like this: my $existingdir = './mydirectory'; open my $fileHandle, ">>", "$existingdir/filetocreate.txt" or die "Can't open…
Haritz
  • 1,702
  • 7
  • 31
  • 50
4
votes
2 answers

Phonegap - Creating a .txt file on first load

I am creating a phonegap app and need to create a new .txt file on first load. After this I need to check whether the file exists and then ignore the creation if that is the case, below is the general flow that I am after: 1 - onDeviceReady -…
SingleWave Games
  • 2,618
  • 9
  • 36
  • 52
4
votes
2 answers

Calling CreateFile using JNA gives UnsatisfiedLinkError: Error looking up function 'CreateFile': The specified procedure could not be found

I'm trying to call Win32's CreateFile function on Windows 7 using JNA with the aim being to do a Java implementation of this answer to checking if a file is in use by another process. The code I have so far is: import com.sun.jna.Native; import…
mikej
  • 65,295
  • 17
  • 152
  • 131
4
votes
2 answers

run python program via clickable desktop icon

I've made a python program using Tkinter(GUI) and I would like to enter it by creating a dedicated icon on my desktop. (I want to send the file to my friend, without him having to install python or any interpreter) the file is a some-what game that…
Hadar
  • 658
  • 4
  • 17
4
votes
1 answer

How do you make an apk create a file on the sdcard when the apk is installed?

I am very new to android development and am looking for a way to modify existing source-code in eclipse so that when the apk is installed, an xml file is copied from inside the apk to a specific folder on the external storage. Is there a way to do…
m13124
  • 51
  • 1
  • 2
  • 3
4
votes
5 answers

Creating a file of arbitrary size using Windows C++ API

I would like to create a file of arbitrary size using the Windows C/C++ API. I am using Windows XP service pack 2 with a 32 bit virtual address memory space. I am familiar with CreateFile. However CreateFile does not have a size arument, The…
Frank
  • 1,406
  • 2
  • 16
  • 42
4
votes
0 answers

C++ CreateFile does not found .txt file in same folder as .exe

I'm trying to use CreateFile function, but it does not go as planned. I did a simple test code : #include #include #include using namespace std; int main() { HANDLE hFile; hFile = CreateFile(_T("test.txt"),…
plowed
  • 49
  • 3
4
votes
6 answers

Converting a string to LPCWSTR for CreateFile() to address a serial port

I seem to be having a bit of a TEXT / UNICODE problem when using the windows CreateFile function for addressing a serial port. Can someone please help point out my error? I'm writing a Win32 console application in VC++ using VS 2008. I can create a…
John
  • 95
  • 1
  • 2
  • 5
1 2
3
31 32