Re: [問題] 陣列內中英文字串的反轉(序)

看板C_and_CPP作者 (chester)時間16年前 (2009/03/22 01:33), 編輯推噓1(103)
留言4則, 2人參與, 最新討論串2/4 (看更多)
正向改寫(反著寫會頭痛) for(int i=0;i<strlen(info);i++){ int num = (int)(unsigned char)info[i]; if(num>=0x80 && num<=0xfe) { infore1[strlen(info)-2-i]=info[i]; infore1[strlen(info)-1-i]=info[i+1]; i++; } else infore1[strlen(info)-1-i]=info[i]; 另外,Ouput 寫檔直接 Output<<infore1; 個人感覺比較方便。 ※ 編輯: yenchenlan 來自: 114.40.78.119 (03/22 09:39)

03/22 11:11, , 1F
<< 可以用在 binary write 嗎?? (我真的不知道)
03/22 11:11, 1F

03/22 11:52, , 2F
好像還是不行XD 我繼續試OTL
03/22 11:52, 2F

03/22 11:55, , 3F
使用Output<<好像不會把內容清掉(?)
03/22 11:55, 3F

03/22 11:56, , 4F
且不知道為什麼輸出檔第一行都會出現一個空的行
03/22 11:56, 4F
文章代碼(AID): #19nPLOx_ (C_and_CPP)
文章代碼(AID): #19nPLOx_ (C_and_CPP)