Re: [問題] 關於一個程式
看板C_and_CPP (C/C++)作者tsaiminghan (nahgnimiast)時間16年前 (2009/03/27 22:04)推噓0(0推 0噓 0→)留言0則, 0人參與討論串6/6 (看更多)
雖然交作業時間已過
#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)
討論串 (同標題文章)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章