Hello everybody i'am building a software to make lab management. So I need to save the data base. and i using SQLite. but I have problem the SQLite pramter is a const char. and the data from the software are CString. and becouse I using Unicode I can't convert them normally. I really need some function to convert from CString - Unicode. To char / const char, and other side.

Please. Tks biny.

5 Years
Discussion Span
Last Post by kndubey88

Which CString? Sadly, there's more than one library with a class called CString, and they all work slightly differently.


First of all tks lot. And I meen for MFC class. And for you ancient I need to know if the link you gave need the all local include are locate ther. Because ther is no link for it


Would you clarify your question because I don't know what you asked???

Scroll down to the section titled "Converting from wchar_t*". Pay attention to the functions that are used, especially wcstombs_s().

Edited by Ancient Dragon: n/a


sure, soory.

this include!

#include "atlbase.h"
#include "atlstr.h"
#include "comutil.h"

CString str = "hello";
char* strBuf = new char[20];
int i = 0;
for(int i = 0 ; i < str.GetLength(); i++)
strbuf = str;
strBuf = NULL;
/*this code is for unicode mfc vc++
and it works.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.