Guest User

Untitled

a guest
Jan 28th, 2016
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <fstream>
  4. using namespace std;
  5.  
  6. struct grp_header {
  7.     short frames, width, height;
  8. } grp;
  9.  
  10. int main(int argc, char ** argv)
  11. {
  12.     ifstream myGrp;
  13.     myGrp.open(argv[1], ios::binary);
  14.     if (myGrp.is_open()) {
  15.         myGrp.seekg(0, ios::beg);
  16.         myGrp.read((char *)&grp, sizeof(short) * 3);
  17.         cout << "File was opened!" << endl;
  18.         cout << "GRP has " << grp.frames << " frames" << endl;
  19.         cout << "GRP has " << grp.width << " pixels width" << endl;
  20.         cout << "GRP has " << grp.height << " pixels height" << endl;
  21.     } else {
  22.         cout << "File was not opened!" << endl;
  23.     }
  24.     myGrp.close();
  25.     cin.clear();
  26.     cin.ignore();
  27.     cin.get();
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment