Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

New to C(++): How do I used cmd-line params?

Name: Anonymous 2006-05-11 11:01

Hay guys!
I wated to program a little program that accepts parameters from the command-line. So I want to open it like

C:\whatever.exe param1 param2 ... paramn

So I wrote a bit.



#include <iostream>
#include <string>
using namespace std;
int main (int argc, string * argv[])
{
  int i;
  string ID;
  string action;
  string mode;
  string file;
  string real_file_name;
  int ret_val;
  ID             = argv[1];
  action         = argv[0];
  mode           = argv[2];
  file           = argv[2];
  real_file_name = argv[3];
//CODE
  return ret_val
}


But when I compile it, there are lots of errors... and they have something to do how I initialize those variables. (something with conversion from string * to basic_string)
argc works fine, but I expected it to :)

What's the problem here? Please explain it a bit or give me a good online-source where I can read this up!

And if you are asking: I'm using the command-line copiler from Microsoft... dunno if that'S important for you, though...

Name: Anonymous 2006-06-21 6:21

The account of that retard's web host maybe

Name: Anonymous 2006-07-04 5:04 (sage)

>>33

And what if X itself is negative?

Name: Anonymous 2010-06-07 6:45

Hi, I can spam /prog/ too, you faggot.

Also, smoke weed everyday.

Name: Sgt.Kabu芕kiman쩖뒲 2012-05-28 18:53

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List