Riverside Learning LABO(Skill/Idea/Code)

よりよいシステムのため工学系と人間系の学習下書きメモ

C*からshort intへ

char文字列項目をshort int数値項目へのメモ


構造体A.Charitem(char項目)
構造体B.Shortitem(short int項目)
一時領域を利用してatoi関数と(short int)キャストを使用する方法


関数内....
memcpy(StrBuf, 構造体Aポインタ->Charitem, StrBuflength);
StrBuf[StrBuflength] = '\0';
IntBuf = atoi(StrBuf);
構造体Bポインタ->tyShort = (short int)IntBuf;