?? makebin.cc
字號:
#include <errno.h>#include <iostream.h>#include <stdio.h>#include <fstream.h>#include <strstream.h>#include <stdlib.h>#include <fcntl.h>#include <sys/stat.h>#include <unistd.h>#include <math.h>#define ITSZ sizeof(int)const int lineSize=8192;const int wdSize=256;ifstream fin;ofstream fout;void convbin(char *inBuf, int inSize){ char inStr[wdSize]; istrstream ist(inBuf, inSize); int it; while(ist >> inStr){ it = atoi(inStr); cout << it << " "; fout.write((char*)&it, ITSZ); } cout << endl;}int main(int argc, char **argv){ char inBuf[lineSize]; int inSize; fin.open(argv[1]); if (!fin){ perror("cannot open in file"); exit(errno); } fout.open(argv[2]); if (!fout){ perror("cannot open out file"); exit(errno); } while(fin.getline(inBuf, lineSize)){ inSize = fin.gcount(); cout << "IN SIZE " << inSize << endl; convbin(inBuf, inSize); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -