Hi all,
I am generating a value by calling some fn which returns uint32_t and storing these values in file. Part of Code as shown below
Code:
//to write content in file
uint32_t c;
ofstream outfile;
outfile.open("output",ios::app|ios::out|ios::binary);
// putting value in file using loop
outfile<<c;
//to read content of file
ifstream myfile ("output");
myfile.is_open();
myfile>>num; // for first record display
printf("value fetched from file: %.8x\n", num);
int record = 2* sizeof(uint32_t); //offset to reach third record
myfile.seekg( record, ios::beg);
myfile>>num1;
printf("value fetched from file: %.8x\n", num1);
myfile.close();
the above code gives some garble value. I tried the next code which gives me just the first value and with offset again gives garble values.
Code:
ofstream outfile;
outfile.open("output");
outfile<<c<<endl;
File "output" contains the value but i am not able to read the value, may be problem with the offset.
pl help
rgds