Tuesday, March 22, 2011

CreateFile vs CreateFileW , CreateFileA

This is the simple explaination:
CreateFileW (Unicode) and CreateFileA (ANSI)
both of them defined by CreateFile

If you want to understand CreateFile, go to msdn page(man page of win API):
http://msdn.microsoft.com/en-us/library/aa363858%28v=vs.85%29.aspx

Here is the link talk about the difference:
http://www.osronline.com/showThread.cfm?link=20658

Note: if you compile following code on Visual studio 2010 Express may have errors, just change CreateFile() to CreateFileA()

hSerial = CreateFile("COM1",
    GENERIC_READ | GENERIC_WRITE,
    0,
    NULL,
    OPEN_EXISTING,
    FILE_ATTRIBUTE_NORMAL,
    NULL);

No comments: