tags:

views:

102

answers:

3

Hi

I would like to access the DeleteFile WINAPI system call within my C Code. When checking the Windows File Management functions it outlines me just the C++ Syntax:

C++

BOOL WINAPI DeleteFile(
  __in  LPCTSTR lpFileName
);

What I would like to know is how I can use this function within pure C code? I have never done anything with the winapi yet, do I just need to include winapi.h to get it work?

+5  A: 

Yes. The Win32 API is a pure C API. I assume the example is labelled as "C++" because more development is done in C++ these days than in C.

Martin B
Thanks to both of you!
+3  A: 

Win32 is a C API, so just go ahead and include windows.h and call the function.

nos
+3  A: 

do I just need to include winapi.h to get it work?

Yes, or actually "windows.h".

You'll also need to link to the right DLLs, for example the API reference for DeleteFile says that it's defined in Kernel32.dll: so you'll need to link your program to Kernel32.lib.

ChrisW