Login Page - Create Account

Support Board


Date/Time: Sun, 11 May 2025 00:09:31 +0000



Post From: CreateFile Compile Error

[2016-05-22 18:00:03]
User892558 - Posts: 5
I've created my own C++ project in VS 2010 Premium following the instructions supplied by SC here "https://www.sierrachart.com/index.php?page=doc/doc_VCExpress.php". I copied in the code from

SCSFExport scsf_WriteBarDataToFile(SCStudyInterfaceRef sc)

in the studies6.cpp, added the appropriate includes like:

#define WIN32_LEAN_AND_MEAN    // Exclude rarely-used stuff from Windows headers
// Windows header file
#include <windows.h>

but get the following compile error:

"error C2664: 'CreateFileW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'"

for the line:

FileHandle = CreateFile(OutputPathAndFileName.GetChars(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL, NULL);

Thanks Bill
imageSierra_Chart_Error.png / V - Attached On 2016-05-22 17:58:53 UTC - Size: 85.52 KB - 253 views