#includechar str2char(string str){ char t=0; for (int i=0;i<8;i++) { if('1'==str[i]) { t|=0x0001; } if (i!=7) { t<<=1; } } return t;}int main(){ FILE *fp; fopen_s(&fp,"test.txt","wb+"); fputc(str2char("00110000"),fp); fclose(fp);}