I had tried to write a string which fetched from a database. into a file...
when i tried to compile the solution the following error occurs like this
error C2664: 'CreateFileW' : cannot convert parameter 1 from 'const char [13]' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Expand|Select|Wrap|Line Numbers
- Code:
- My codings are below...
- ----------------------------------------------------------------------
- void main()
- {
- MYSQL *conn;
- conn = mysql_init(NULL);
- mysql_real_connect(conn,host,username,password,database,0,NULL,0);
- MYSQL_RES *res_set;
- MYSQL_ROW row;
- mysql_query(conn,"SELECT * FROM imagedb2");
- res_set = mysql_store_result(conn);
- unsigned int numrows = mysql_num_rows(res_set);
- //For Creating a file....
- HANDLE hFile;
- DWORD wmWritten;
- hFile =CreateFile"d:\\text3.doc",GENERIC_READ|GENERIC_WRITE,
- FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
- while (( row = mysql_fetch_row(res_set)) != NULL)
- {
- char str[255];
- char *tmp = str;
- strcpy(str, row[2]);
- WriteFile(hFile,str,(DWORD)(sizeof(str)),&wmWritten,NULL);
- CloseHandle(hFile);
- }
- mysql_close(conn);
- getch();
- }
- In Project->Properties->General->Character Set::Use Multi-Byte Character Set
What shall i do for the above error...
Can any one plzz help me??