Unicode 轉化 GB18030 編碼 方法

2021-07-12 01:00:22 字數 1131 閱讀 3957

**頁詳細知識:

int fgetline(file *fp, char *ch, int size = 1024)

}ch[i - 1] = '\0';

return i - 1;

}int unicode_fgetline(file *fp, wchar_t *wch, int size = 1024)

}wch[i - 1] = 0;

return i - 1;

}int readconffile(setup &s,item *pitem,int is_unicode)

if (is_unicode)//如果配置檔案是unicode 格式

fseek(fp, 2, seek_set);// 跳過unicode文字開頭有兩個位元組0xfffe(稱作bom,用於標識unicode編碼)

wchar_t wch[1024];

char ch[2048];

int i;

char cht;

while (!feof(fp))

if (strncmp(ch, "行數", 4) == 0)

s.row = atoi(ch + 5);

else if (strncmp(ch, "列數", 4) == 0)

s.col = atoi(ch + 5);

else if (strncmp(ch, "背景色", 6) == 0)

s.bgcolor = atoi(ch + 7);

else if (strncmp(ch, "前景色", 6) == 0)

s.fgcolor = atoi(ch + 7);

else if (strncmp(ch, "屏延時", 6) == 0)

s.screensleep = atof(ch + 7);

else if (strncmp(ch, "條延時", 6) == 0)

s.itemsleep = atof(ch + 7);

else if (strncmp(ch, "特效", 4) == 0)

else if (strncmp(ch, "item", 4) == 0)}}

fclose(fp);//關閉檔案

return 0;

}

Unicode型別的CString轉化為char

cstring strpath l adfafs主聲音檔案fsfsa int nlength strpath.getlength int nbytes widechartomultibyte cp acp,0,strpath,nlength,null,0,null,null char voicepa...

ASP中漢字和Unicode的相互轉化

網上有很多類似的文章,但多數是一大堆 其實asp有內建的處理unicode的函式,很簡單的幾句 就可以完成轉化 推薦指數 將漢字轉化為unicode 不支援第二平面漢字,但幾乎極少有人能夠使用到這些漢字 function getunicode hanzi dim str str left hanzi...

數字與字串相互轉化 Unicode

vc中數字與字串轉換方法 1,char是最原始的字元資料型別,在非unicode版本的arx中使用 2,wchar t是寬位元組字元型別,在unicode版本中的arx中使用 3,t 是乙個巨集,可以將裡面的字串轉化成所在工程環境中的字元型別 4,tchar是unicode的一種,等同於 t 這個巨...