buf 数据写入文件
FILE *stream; if ((stream = fopen("/root/aaa.pdf", "wb")) == NULL) /* open file TEST.$$$ */ { fprintf(stderr, "Cannot open output file.\n"); return 1; } fwrite(dest_buf, dest_size, 1, stream); /* 写的struct文件*/ fclose(stream); /*关闭文件*/
参考c++:
fstream file("/root/bbb.pdf", ofstream::app | ios::binary | ofstream::out);
if (!file){
cerr << "open sec.txt failure" << endl;
}
for ( int i = 0; i != m_FileLen; i++){
file.write((char *)&m_pFileBuf[i] , sizeof(m_pFileBuf[i]));
}
cout << endl;
file.close();
file.clear();
浙公网安备 33010602011771号