開發平台(Platform): (Ex: Win10, Linux, ...)
linux debian
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
gcc 6.3
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
no
問題(Question):
問題如下詳述
餵入的資料(Input):
int s=5;
char a[7]={0};
char p[]="414243444546";
htos(a,p,s);
printf("%d,%s\n",s,a);
預期的正確結果(Expected Output):
5,ABCDE
錯誤結果(Wrong Output):
0,ABCDE
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
hex to string的程式碼
void htos(char *dst,const char *src,int len)
{
for (;len>0 && src[0] && src[1] && sscanf(src, "%2X", dst++) ;len