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

How to rename a file without closing all of it's open file handles?

I create GENERIC_READ file handle with createFile. This is my instruction : hfile := CreateFileA(aFileName, GENERIC_READ, FILE_SHARE_READ or FILE_SHARE_WRITE, …
zeus
  • 12,173
  • 9
  • 63
  • 184
-1
votes
1 answer

How do I create a new text file after every loop in a while loop?

I have a piece of text which I want to write in different text files, so I'm using a while loop to create a new txt file after every loop. However I don't know how to create a new text file AFTER every loop has been completed. For the text, I have a…
user6842389
  • 49
  • 1
  • 4
  • 8
-1
votes
1 answer

windows c : failed to create mmap of a file

I need to create mmap of a file. Since windows does not support mmap, i tried MapViewOfFile() method. But this fails. Here's my code : char template[1024]; snprintf(template, sizeof(template) / sizeof(char), "%s",…
Ijas Ahamed N
  • 5,632
  • 5
  • 31
  • 53
-1
votes
1 answer

DeviceIoControl() returned data meaning

I've been reversing an exemplary application given in class & I'm facing a problem trying to find out what the DeviceIoControl() function is returning in the Output Buffer & since DeviceIoControl() is often used after calling CreateFile(), i have to…
afr0ck
  • 65
  • 6
-1
votes
1 answer

Regarding batch file to delete 0 KB file

I want to create a batch file that should delete only 0 KB file. I have created a batch but it also delete file of 1 KB. So please help me out with perfect suggestions to delete only 0 KB. I used below code but it also delete 1 KB file. for /r %%F…
-1
votes
2 answers

Creating a file and writing something into it does not work how I wanted it

I write the following code: #include #include "stdbool.h" #include #include #include #include #include #define MAX_SIZE 100 …
user3097712
  • 1,565
  • 6
  • 27
  • 49
-1
votes
1 answer

Create image file using js (NOT PHP)

I have a question. In my web app I create an image file using a little php script. It is possible to create a file and re-use it with js? Thanks. I find some script that convert canvas2image. The main problem is that I wolud save the image in my…
salvo italy
  • 193
  • 2
  • 4
  • 14
-1
votes
2 answers

Not creating file via my browser

when I run my page on my local host it does not create the file. I have given read and write permissions to the folder site. i have used system and exec functions and when i run the page via the terminal it creates a file but via my browser it…
Meryvn
  • 65
  • 3
  • 12
-1
votes
1 answer

Calling ::CreateFile for a modem in C++ always returning ERROR_SHARING_VIOLATION

I have a modem on COM44 and when I try to access it via C++ I end up receiving ERROR_SHARING_VIOLATION. The code I am using is and m_hFile ends up as -1: void* m_hFile; m_hFile = ::CreateFile( "\\\\.\\COM44", GENERIC_READ | GENERIC_WRITE, …
Ryland
  • 117
  • 1
  • 2
  • 14
-2
votes
1 answer

Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )

Ok, so im writing a program that transfers files from my usb to a computer (so i can set up stuff quickly for something im doing on monday) and im trying to make it make a shortcut on the desktop so that you dont have to go into the source folder of…
Abraham Andujo
  • 147
  • 1
  • 6
  • 12
-2
votes
2 answers

Creation of multiple text files using C# in Visual Studio from DGView data

Hi all I am having the following results in my data grid view, I want to print these data to multiple text files. Text files should be in the format that it should start with 1stLine(Column Value Please see the image) and end at LastLine(Column…
bowbow
  • 13
  • 4
-2
votes
3 answers

[WIN API]Why sharing a same HANDLE of WriteFile(sync) and ReadFile(sync) cause ReadFile error?

I've search the MSDN but did not find any information about sharing a same HANDLE with both WriteFile and ReadFile. NOTE:I did not use create_always flag, so there's no chance for the file being replaced with null file. The reason I tried to use the…
Lynch Chen
  • 178
  • 2
  • 16
-2
votes
1 answer

I'm trying to retrieve the serial number of a hard drive or a battery tag

#include "stdafx.h" #include #include #include #include #include #include #include typedef struct _MEDIA_SERIAL_NUMBER_DATA { ULONG SerialNumberLength; …
JuJi
  • 13
  • 4
-2
votes
2 answers

creating a new blank .txt file using matlab

How can I create a blank .txt file? I use Matlab R2014a. I want to check whether file of specified name exists and if it does not, I want to create one.
Thara
  • 489
  • 1
  • 8
  • 24
-2
votes
1 answer

Cant create a handle, or handle is invalid - WinAPI (CreateFile)

This is a piece of my code: #include #include #include #include #include #include int main(int argc, char * agrv[]) { //Convert argument 2 to…
1 2 3
31
32