having a rough day today so thought id throw out a post for help.
the scenario is this, i have a program that creates datasets, with my original coding the data was outputted as padded char's as such:-
unfortunately the dataset files are getting absolutely huge (several gig), so i have attempted to remove the padding to form a new structure based on an unsigned long long (since unpadded the max data length is 56 bits) the new structure looks like this:-
however im faced with an endian problem when writing the info to file.
i can think of several ways to code around it, but was wondering if anyone knew of a inbuilt function to save me some time.
thanx for any input
If somethings hard to do, its not worth doing - Homer Simpson
too much 49374'ing, im 57005... need 12648430
the scenario is this, i have a program that creates datasets, with my original coding the data was outputted as padded char's as such:-
Code:
type 1 data
[byte][byte][byte][byte][byte][byte]
[type][ set1 ][ set2 ][qual]
type 2 data
[byte][byte][byte][byte][byte][byte][byte][byte]
[type][ set1 ][ set2 ][ data1 ][qual]
type 3 data
[byte][byte][byte][byte][byte][byte][byte][byte][byte]
[type][ set1 ][ set2 ][ data1 ][res1][qual]
type 4 data
[byte][byte][byte][byte][byte][byte][byte][byte][byte][byte]
[type][ set1 ][ set2 ][ data1 ][res1][res2][qual]
unfortunately the dataset files are getting absolutely huge (several gig), so i have attempted to remove the padding to form a new structure based on an unsigned long long (since unpadded the max data length is 56 bits) the new structure looks like this:-
Code:
type 1 data
[nibbnibb][nibbnibb][nibbnibb][nibbnibb]
[typset1 ][ se][t2 ][ qu<pad>]
type 2 data
[nibbnibb][nibbnibb][nibbnibb][nibbnibb][nibbnibb][nibbnibb]
[typset1 ][ se][t2 ][ data1 ][ ][qu< pad>]
type 3 data
[nibbnibb][nibbnibb][nibbnibb][nibbnibb][nibbnibb][nibbnibb]
[typset1 ][ se][t2 ][ data1 ][ ][res1 qu]
type 4 data
[nibbnibb][nibbnibb][nibbnibb][nibbnibb][nibbnibb][nibbnibb][nibbnibb]
[typset1 ][ se][t2 ][ data1 ][ ][res1 re][s2 qu<>]
however im faced with an endian problem when writing the info to file.
Code:
//example type 1
fstream myFile("C:\\SomeFile.txt",ios::out | ios::binary);
ULONGLONG thedata=0x0000000020043300;
myFile.write ((char*)&thedata, 4);
myFile.close();
//when viewed in the file becomes "Hex: 00 33 04 20"
//idealy i need "Hex: 20 04 33 00" so i can retrieve
//the type and determine how many bytes belong to this
//data
i can think of several ways to code around it, but was wondering if anyone knew of a inbuilt function to save me some time.
thanx for any input
If somethings hard to do, its not worth doing - Homer Simpson
too much 49374'ing, im 57005... need 12648430