Re: [問題] 關於一個程式
雖然交作業時間已過
#include <iostream>
#include <fstream>
#include <algorithm>
#define dim(x) (sizeof(x)/sizeof(x[0]))
using namespace std;
ifstream inf;
ofstream outf;
inf.open("D:\\input_ANSI.txt");
outf.open("D:\\output_ANSI.txt");
char cBuf[256] = {0};
wchar_t szBuf[256] = {0};
setlocale( LC_ALL, "cht");
while(inf.getline(cBuf, dim(cBuf)))
{
mbstowcs(szBuf, cBuf, strlen(cBuf));
reverse(szBuf, szBuf + wcslen(szBuf));
wcstombs(cBuf, szBuf, wcslen(szBuf)*2);
outf << cBuf << endl;
}
inf.close();
outf.close();
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.168.72.157
※ 編輯: tsaiminghan 來自: 218.168.72.157 (03/27 22:05)
討論串 (同標題文章)