source: fact/tools/pyscripts/sandbox/dneise/fact_compress/c++/test.cpp@ 18342

Last change on this file since 18342 was 14268, checked in by neise, 12 years ago
evolving
File size: 561 bytes
Line 
1#include <iostream>
2#include <fstream>
3#include <stdio.h>
4
5using namespace std;
6int main()
7{
8 ofstream out ("test.bin", ios::binary);
9
10 short *a = new short[10];
11 char *b = (char*)a;
12 for (int i=0; i<10; i++)
13 {
14 a[i] = -1938+i;
15 }
16
17 for (int i=0; i<20; i++)
18 {
19 printf("%X ", (unsigned char)b[i]);
20 }
21 printf("\n");
22 for (int i=0; i<20; i++)
23 {
24 printf("%X ", ((unsigned char*)a)[i]);
25 }
26 printf("\n");
27
28 out.write((char*)a, 10*sizeof(short));
29 out.write(b, 10*sizeof(short));
30 out.write(b, 20);
31
32 out.close();
33 return 0;
34}
Note: See TracBrowser for help on using the repository browser.