C Strings help
Hello Everyone!
I'm not a fan of C Strings, but it's the only way I know to get an argument string to be used in my program.
Could someone please point out what's wrong, and then offer a substitute using C++ Strings?
1 2 3 4 5 6 7 8 9 10 11 12
|
int main(int argc, char *argv[])
{
//
char url[] = "http://";
char suff[MAX];
strcpy(suff, argv[1]);
strcat(url, suff);
printf("%s\n", url);
return 0;
}
|
Thanks!
cout << "http://"+string(argv[1]) << endl;
Topic archived. No new replies allowed.