Some help using stat() to...

I'm having a hard time starting my homework as it starts with the stat() function, something I've yet to see. We are to use stat() to check if a file exsists, if it does not created that file. The work is beimg done on a Unix machine and the file will receive command line arguments. I've assumed it would look something like this

1
2
3
4
  if(stat(argv[]==1)
  {cout<<"exists"<<endl;
   else if (stat(argv[]==-1)
    cerr<<"does not exsist"<<endl;

The problem I'm running Into is figuring out how to make the file if it doesn't exsist.
Last edited on
Topic archived. No new replies allowed.