Cの構造体からの文字列の印刷に問題があります...
typedef struct box{
char *REF_OR_SYS; int num, x, y, w, h, o;
}BOX;
sscanf(str, "%s %d %d %d %d %d %d", &label, &refNum, &x, &y, &w, &h, &o);
BOX detect = {label, refNum, x, y, w, h, o};
printf("\nLABEL IS %s\n", detect.REF_OR_SYS); //Prints out the String correctly
//(Either the word REF or SYS)
return detect;
これが構造体が別の構造体に渡されると、文字列を除いてすべてが正しく表示されます。
void printBox(BOX detect){
printf("Type: %s Ref: %d X: %d Y: %d W: %d H: %d O:%d\n",
detect.REF_OR_SYS, detect.num, detect.x,
detect.y, detect.w, detect.h, detect.o);
}
私は何か簡単なものが欠けていますか?REF_OR_SYSは常に??_?として出力されます