File I/O and Command Line Parameters

I need to write a program that will take a command line parameter of a filename followed by an int. The file will be a list of shorts that I need to push onto the stack.
So far I have made this thing:

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <fstream>
#<include<iostream>
using namespace std;

int main(int argc, char *argv[]){

ifstream argv[0];
while(!OpenFile.eof())
{OpenFile.get(ch);

}
system ("PAUSE");
}


I know it's wrong already. Someone please help.
Line 7 is declaring an array of zero ifstreams called argv, you want to declare an ifstream called OpenFile and pass argv[1] as constructor argument
( argv[0] is the name of the program, argv[1] is the first argument but you should always check argc before using argv )
Topic archived. No new replies allowed.