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;

    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?