Quantcast
Channel: CodeGuru Forums - C++ and WinAPI
Viewing all articles
Browse latest Browse all 583

How to add data by Using Function CreateFile(...)

$
0
0
I try to Create one text File By Using CreateFile(..) Function,

I want to add data ( x,y,x) coordinate to file By This way :

X Y Z
1 3 8
0 13 11

But when I write code I see Data Like this :
XYZ13801311,

I request any sample example to show me how to add and read data :

this is my code :
Code:

HANDLE hf; DWORD FileSize  ;
                hf =        CreateFile(TEXT("AAA.txt"),GENERIC_WRITE,NULL,NULL,OPEN_ALWAYS,NULL,NULL);
                FileSize = GetFileSize(hf,NULL);
                int a = sizeof(TEXT("x"));
WriteFile(hf,TEXT("x"),a,&FileSize,NULL);
WriteFile(hf,TEXT("y"),a,&FileSize,NULL);
WriteFile(hf,TEXT("z"),a,&FileSize,NULL);
WriteFile(hf,TEXT("1"),a,&FileSize,NULL);
WriteFile(hf,TEXT("3"),a,&FileSize,NULL);
...........
............
CloseHandle(hf);


Viewing all articles
Browse latest Browse all 583

Trending Articles