Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // readlst.cpp : Defines the entry point for the console application.
- //
- struct trigger
- {
- unsigned int buffID;
- unsigned int triggerID;
- char data[76];
- };
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- fstream listFile;
- vector<trigger> Data;
- unsigned int size;
- //vector<unsigned char> outbuff;
- unsigned int first;
- listFile.open("tagbufftrigger.lst", fstream::in|fstream::binary);
- if( !listFile.good() )
- {
- cout<< listFile.good() <<endl;
- return 0;
- }
- //Get the file size
- listFile.seekg(0, ios::end); //seek to the end
- size = listFile.tellg(); // get the length
- listFile.seekg(0, ios::beg); // seek back to beginning
- cout<< "Size of file is "<< size << endl;
- //seeking forward for now.
- listFile.read( (char*)&first, sizeof(unsigned int) );
- cout<< "First four is: "<< first << endl;
- //Data.resize(first);
- for( unsigned int i = 0; i < first; ++i )
- {
- listFile.read( (char*)&Data[i], sizeof(trigger));
- }
- vector<trigger>::iterator it = Data.begin();
- for( it; it != Data.end();++it)
- {
- cout<< "BuffID: " << hex << it->buffID << endl;
- cout<< "triggerID "<< hex << it->triggerID << endl;
- cout<< endl;
- }
- listFile.close();
- return 0;
- }
Add Comment
Please, Sign In to add comment