Trouble with function call char *filename

Hi,
I am trying to use this function

void Graph::load (char *fileName)

Where what I am trying to pass in is a command line argument from argv[] in my int main(int argc, char *argv[]). I can't get it to compile with anything I pass into it. I've tried just the argv[i], tried converting to a regular string and tried it as a regular character array. Any suggestions?
Last edited on
It should compile fine with argv[i]

This program runs just fine:

1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>

void test(char* s)
{
  std::cout << s;
}

int main(int argc,char* argv[])
{
  test( argv[0] );
  return 0;
}
Ah I'm stupid. It was an include problem with my Eclipse Makefile!
Topic archived. No new replies allowed.