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
3
votes
1 answer

Cannot Get ReadFile to work with a Physical Drive

I can get ReadFile to read a simple text file, but cannot get it to work correctly with a physical drive. I get the error "The parameter is incorrect" from GetLastError. My code is as follows and provides more information: using System; using…
user4437649
3
votes
2 answers

How do I tell CreateFile that I want to append to an existing file?

I am using Delphi 2010 and looking for a way to use CreateFile Windows API function to append data rather than overwriting it in the specified file? I am not looking for an optional way to do it such as Append() or Rewrite() or similar. I am…
d.b
  • 95
  • 2
  • 9
3
votes
3 answers

CreateFile CREATE_NEW equivalent on linux

I wrote a method which tries to create a file. However I set the flag CREATE_NEW so it can only create it when it doesnt exist. It looks like this: for (;;) { handle_ = CreateFileA(filePath.c_str(), 0, 0, NULL, CREATE_NEW,…
Tim Kathete Stadler
  • 1,067
  • 4
  • 26
  • 52
3
votes
3 answers

How to check folder have write permission or not in c++

I would like to write a file inside a "d:\test\" unfortunately I don't have a write permission for that folder. How to check whether that folder have a write permission or not. NOTE: fopen is helpful,But that's creates a new file. I don't want to…
bala
  • 275
  • 2
  • 3
  • 13
3
votes
1 answer

How do you open NTFS metadata/System Files: $LogFile, $Volume, $Bitmap?

I am running on 64-bit Windows 7. I want to get the FileID associated with some of the NTFS System Files. Some of them ("$Mft", "$MftMirr") I can open but others ("$LogFile" and "$Bitmap") fail with an "access denied" error or invalid parameter…
3
votes
3 answers

Why is an extra file being created in FOR loop of batch program?

I've written the following batch file to create multiple files using FOR loop: @echo off cls FOR /L %%i IN (1 1 10) DO ( echo.> file%%i.txt IF ERRORLEVEL 0 echo Successfully created file 'file%%i.txt'. ) dir /b *.txt FOR %%i…
Satyendra
  • 1,635
  • 3
  • 19
  • 33
3
votes
2 answers

Windows: How to intercept Win32 disk I/O API

On Windows, all disk I/O ultimately happens via Win32 API calls like CreateFile, SetFilePointer, etc. Now, is it possible to intercept these disk I/O Win32 calls and hook in your own code, at run time, for all dynamically-linked Windows…
Harry
  • 3,684
  • 6
  • 39
  • 48
3
votes
8 answers

How to create a super-huge file with pure c or linux-shell or dos-commands?

My os and drive is OS: Windows XP sp2 or Linux SUSE 9 or Cygwin Compiler: Visual C++ 2003 or Gcc or Cygwin PC and os are both 32 bits So, How can I create a super-huge file in secs I was told to use MappingFile functions. I failed to create files…
StevenWang
  • 3,625
  • 4
  • 30
  • 40
3
votes
3 answers

NSFileManager createFileAtPath failing on iPad but works on Simulator

I am trying to write a simple log file for each execution of my app. The logfile name is based on the current time and is stored in the app directory. The code below is what I am trying which works on the simulator but when I execute on an iPad it…
allanmb
  • 321
  • 3
  • 14
3
votes
1 answer

Best way to create a lot of small files?

I want to create a lot (1 million) small files as quickly as possible, that's what I'm doing now: for(long i = 0; i < veryVeryLong; i++){ using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, 4096,…
Slovo
  • 212
  • 2
  • 11
3
votes
2 answers

Accessing files with invalid names in Windows

I'm running Windows 7 in a VirtualBox on an OS X 10.8 host. The host has a shared folder with a file named >>>FILE<<< inside. Apparently, OS X itself has no problem with such file names. Unfortunately, I can't seem to open this files in Windows 7…
GOTO 0
  • 42,323
  • 22
  • 125
  • 158
3
votes
1 answer

Can't access to directory created by CreateDirectory

I'm confused with following situation. My application attempts to find a specified directory: HANDLE _dh, _fh; // Handles for a files _dh = CreateFile(_ddn, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,…
Geradlus_RU
  • 1,466
  • 2
  • 20
  • 37
3
votes
1 answer

Handle does not support synchronous operations with CreateFile

I need to open read disk in raw mode, so I'm using CreateFile API function for that purposes. private static FileStream OpenDisk(string drive) { // Try to open hard disk drive in raw mode for reading SafeFileHandle safeHandle =…
axe
  • 2,331
  • 4
  • 31
  • 53
3
votes
1 answer

Create and download a text file using php

Here's what I'm trying to do. I have a series of reports that they also want to be able to download as comma delimited text files. I've read over a bunch of pages where people say simply echo out the results rather than creating a file, but when I…
Jhorra
  • 6,233
  • 21
  • 69
  • 123
2
votes
4 answers

Warning: file_put_contents - cannot create file using php

When I am trying to do this: $txt = file_get_contents('http://stats.pingdom.com/file'); file_put_contents('/stats/file.html',$txt); I am getting following error: Warning: file_put_contents(stats/stats.html) [function.file-put-contents]: failed to…
Chriswede
  • 935
  • 2
  • 12
  • 31