opencv + counting frames

Here is the code I got from Internet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "/usr/local/include/opencv/cv.h"
#include "/usr/local/include/opencv/cvaux.h"
#include "/usr/local/include/opencv/highgui.h"
      int  nFrames;
      char tempSize[4];
      // Trying to open the video file
      ifstream  videoFile( "hiriye-shael.avi" , ios::in | ios::binary );
      // Checking the availablity of the file
      if ( !videoFile ) {
	cout << "Couldn¡¯t open the input file" << hiriye-shael.avi << endl;
      exit( 1 );
      }
      // get the number of frames
      videoFile.seekg( 0x30 , ios::beg );
      videoFile.read( tempSize , 4 );
      nFrames = (unsigned char ) tempSize[0] + 0x100*(unsigned char ) tempSize[1] + 0x10000*(unsigned char ) tempSize[2] +    0x1000000*(unsigned char ) tempSize[3];
  16.
      videoFile.close(  );

these are the errors
1
2
3
4
5
6
NetBeansProjects/Frames.cpp:7: error: ‘ifstream’ does not name a type
NetBeansProjects/Frames.cpp:9: error: expected unqualified-id before ‘if’
NetBeansProjects/Frames.cpp:14: error: expected constructor, destructor, or type conversion before ‘.’ token
NetBeansProjects/Frames.cpp:15: error: expected constructor, destructor, or type conversion before ‘.’ token
NetBeansProjects/Frames.cpp:16: error: expected constructor, destructor, or type conversion before ‘=’ token
NetBeansProjects/Frames.cpp:17: error: expected unqualified-id before numeric constant

thanks in advance
I don't know the opencv but I see two errors in this code:
1
2
3
4
5
6
7
8
include "/usr/local/include/opencv/cv.h"
#include "/usr/local/include/opencv/cvaux.h"
#include "/usr/local/include/opencv/highgui.h"

#include <fstream> // error in 7 and 9 line is OK
using namespace std;

// in 17 line  is unnecessary 
thanks for your reply and I did changes what you have suggested in earlier Post and then also got the same error
Errors:
1
2
3
4
5
6
NetBeansProjects/Frames.cpp:8: error: ‘fstream’ does not name a type
NetBeansProjects/Frames.cpp:10: error: expected unqualified-id before ‘if’
NetBeansProjects/Frames.cpp:15: error: expected constructor, destructor, or type conversion before ‘.’ token
NetBeansProjects/Frames.cpp:16: error: expected constructor, destructor, or type conversion before ‘.’ token
NetBeansProjects/Frames.cpp:17: error: expected constructor, destructor, or type conversion before ‘=’ token
NetBeansProjects/Frames.cpp:18: error: expected constructor, destructor, or type conversion before ‘.’ token
Topic archived. No new replies allowed.