You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#include <fstream>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include <thread>
#include <vector>
//
#include <winsock2.h>
//
#include <Windows.h>
//
#include <stdio.h>
#pragma comment(lib, "ws2_32.lib")
#define PORT 8988
int main(int argc, char *argv[]) { // ���� 0.bin
// ��ȡ 0.bin ��������
// ÿ�ζ�9byte
// 3byte 3byte 3byte
// ���ŵ�0.csv��
std::ifstream ifs("0.bin", std::ios::binary); if (!ifs) { std::cerr << "open 0.bin failed" << std::endl; return -1; }
std::ofstream ofs("0.csv", std::ios::binary | std::ios::trunc); if (!ofs) { std::cerr << "open 0.csv failed" << std::endl; return -1; }
char buf[9]; while (ifs.read(buf, 9)) { unsigned int a = 0; unsigned int b = 0; unsigned int c = 0; a = (unsigned char)buf[0] | (unsigned char)buf[1] << 8 | (unsigned char)buf[2] << 16; b = (unsigned char)buf[3] | (unsigned char)buf[4] << 8 | (unsigned char)buf[5] << 16; c = (unsigned char)buf[6] | (unsigned char)buf[7] << 8 | (unsigned char)buf[8] << 16; ofs << a << "," << b << "," << c << std::endl; }
return 0; }
|