我有一個簡單的「加密」函數,它與wstring變量一起使用,我想用wofstream將此函數的結果寫入文件。 這是我的代碼: void save_file() {
wstring text = L"Text to be encrypted. The text is encrypted but not saved";
wstring enctext = encrypt(text)
我想寫一個std::wstring到一個文件上,並且需要讀取那個內容爲std:wstring。當字符串爲L"<Any English letter>"時,正如預期的那樣發生。但是,當我們有像孟加拉語,卡納達語,日語等任何非英文字母的字符時,問題就會發生。嘗試了各種選項,如: 轉換的std::wstring到std::string和寫入到文件和讀取時間讀取爲std::string,並轉換爲std::
我開發了一個C++應用程序,用於在隨機訪問文件上讀取和寫入數據。 (我使用Visual C++ 2010) 這裏是我的程序: #include <iostream>
#include <fstream>
#include <string>
using namespace std;
class A
{
public :
int a;
string b;