wstring

    0熱度

    1回答

    什麼,我需要做的是執行一個SQL查詢: wstring query = (L "INSERT INTO database...........; 然後我執行此: CHECK(SQLExecDirectA(hStmt, query, SQL_NTS), "execute query"); ,但它並沒有編譯,因爲變量查詢必須是一個SQLCHAR否則函數SQLExecDirectA不會工作。 任

    1熱度

    2回答

    我有兩個文件,my_program.cpp及其標題my_program.h。 my_program.cpp包含僅此: #include "my_program.h" using namespace std; my_program.h包含一個指向它返回一個wstring一個函數,如下所示: using namespace std; typedef wstring (*my_function)

    6熱度

    1回答

    以下代碼在Visual Studio 2010中編譯,但無法在Visual Studio 2012 RC中編譯。返回 #include <string> // Windows stuffs typedef __nullterminated const wchar_t *LPCWSTR; class CTestObj { public: CTestObj() {m_tmp =

    0熱度

    1回答

    我試圖在編譯成功後編譯這個程序,它在控制檯窗口上打印程序的當前目錄。 但該程序的工作是向我展示所有擴展名爲.doc的文件,當我不使用寬字符串wstring()時,它也能正常工作。所以這是我想用wstring函數編譯此程序的問題。 UPDATE: 此代碼正常工作: #define UNICODE #include <string> #include <vector> #include <ios

    1熱度

    2回答

    很多時候,當我與人交談時,他們會重新使用(在DLL項目中)wstrings和字符串,因爲它們消耗的內存比wchar_t數組多。它怎麼樣?同樣的L"qweqweqweqweqwe" wchar_t數組比wstring需要更多的內存,或者它不明顯?現在,我當我必須ANSI和Unicode(許多new wchar_t temp和delete)

    0熱度

    2回答

    我遇到了wstringstream的問題。當我這樣做 std::wstringstream ss; wchar_t* str = NULL; ss << str; 應用程序崩潰,錯誤 Unhandled exception at 0x53e347af (msvcr100d.dll) in stringstr.exe: 0xC0000005: Access violation

    0熱度

    1回答

    我想從vector <wstring>獲得文件名後搜索操作我想vecAviFiles上的所有文件複製到另一個路徑(例如D:\ Test)。 int main() { int iRC = 0; std::vector<std::wstring> vecAviFiles; std::wstring fileCopiedDestination

    0熱度

    1回答

    以下代碼將string轉換爲wstring,我需要調用我正在使用的stemming方法。但是,我在其中存儲詞幹詞的map充滿了strings。我環顧了一些關於SO的解決方案,其中許多從wstring到string的轉換大約有十幾行代碼。 有什麼辦法可以將string快速(最好是行內或類似的)轉換爲wstring並返回? string ANSIWord("documentation"); wcha

    2熱度

    2回答

    或者如何使用wchar_t *初始化一個wstring? 我嘗試了這樣的事情,但它不是很有效。 我給了一個LPVOID,它指向一個wchar_t指針。 我只想把它放到一個wstring中,這樣我就可以使用一些正常的字符串函數。 LPVOID lpOutBuffer = NULL; //later in code this is initialized this way lpOutBuffer

    3熱度

    2回答

    下面是代碼: std::ofstream f("file1.txt"); f<<"123"<<std::endl<<"456"; //(*1) /*std::stringstream ordinary_strstream; This works too ordinary_strstream<<"123"<<'\n'<<"456"; f<<ordinar