wofstream

    5熱度

    2回答

    我有多字節字符串的問題。我簡化了我的問題如下: std::wstring str = L"multıbyte test string"; std::wofstream f; f.open("F:\\dump.txt"); f << str; f.close(); 和轉儲文件的內容是:「MULT」 爲什麼它削減str的剩餘部分altough我已經使用的wstring和wofstream?

    0熱度

    1回答

    我想解析utf-8文件到ustring,我在str中讀取這個文件。 發生錯誤: 在拋出'Glib :: ConvertError'的實例後終止調用。 我該怎麼辦? char* cs = (char*) malloc(sizeof(char) * str.length()); strcpy(cs, str.c_str()); ustring res; while (strlen(cs) > 0

    0熱度

    1回答

    我有一個簡單的「加密」函數,它與wstring變量一起使用,我想用wofstream將此函數的結果寫入文件。 這是我的代碼: void save_file() { wstring text = L"Text to be encrypted. The text is encrypted but not saved"; wstring enctext = encrypt(text)

    2熱度

    1回答

    我試圖通過我的應用程序 多次使用FILE指針爲此我雖然我創建一個函數並通過該指針傳遞。基本上我有這段代碼 FILE* fp; _wfopen_s (&fp, L"ftest.txt", L"r"); _setmode (_fileno(fp), _O_U8TEXT); wifstream file(fp); 這是重複的,現在反而我想有這樣的事情: wifstre

    0熱度

    1回答

    我在編譯時和鏈接從一個批處理文件,這個源代碼,我是對的導入庫現在MSVCRT.LIB Kernel32.lib User32.lib 代碼工作,直到我包括stringiostream和fstream,並創建一些wofstream對象。這是當鏈接器顯示我一大堆未解決的符號,其中: std::_BADOFF static class std::locale::id std::codecvt std

    0熱度

    2回答

    我在處理Unicode轉換時遇到了一些麻煩。 以下代碼將其輸出到我的文本文件中。 HELLO 36 O std::string test = "HELLO"; std::string output; int len = WideCharToMultiByte(CP_OEMCP, 0, (LPCWSTR)test.c_str(), -1, NULL, 0, NULL, NULL); char

    0熱度

    1回答

    我做了我的簡單txt掃描器,他將文本寫入與我的選擇匹配的文件中。問題是寫入文件時,而不是筆寫入,例如,洀漀。在照片中可以看到,例如: #include <iostream> #include <fstream> #include <string> using namespace std; int main() { int offset; wstring DBSearchLine,

    7熱度

    5回答

    我想寫一個std::wstring到一個文件上,並且需要讀取那個內容爲std:wstring。當字符串爲L"<Any English letter>"時,正如預期的那樣發生。但是,當我們有像孟加拉語,卡納達語,日語等任何非英文字母的字符時,問題就會發生。嘗試了各種選項,如: 轉換的std::wstring到std::string和寫入到文件和讀取時間讀取爲std::string,並轉換爲std::

    0熱度

    1回答

    考慮我的日誌類 void LogWriter::InitLogWriter(void) { wcout.flush(); wcerr.flush(); COUT_BACKUP = wcout.rdbuf(); // save original cout buffer CERR_BACKUP = wcerr.rdbuf(); //save original

    0熱度

    1回答

    我開發了一個C++應用程序,用於在隨機訪問文件上讀取和寫入數據。 (我使用Visual C++ 2010) 這裏是我的程序: #include <iostream> #include <fstream> #include <string> using namespace std; class A { public : int a; string b;