Parsing command line arguments to main and for a function other than main

hey guys,
this programme works when I'm not using a separate function 'genWordSeg' and writing it only using main().
But when i'm going to do it according to the OO concepts it gives me an error that " expected primary-expression before ‘]’ token" and I couldn't find the error.

I'm a new comer to this valuable forum and I'm waiting for your responses regarding this issue..

These are my code segments:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>

class ts
{
	int genWordSeg(int size ,char* charArr[]);
};

int genWordSeg(int size ,char* charArr[])
{
//stuff here
}


main(int argc, char* argv[])
{
	
	ts t;
	t.genWordSeg(argc, argv[]);
}
Last edited on
Don't pass the argv with the [] on line 21.
int genWordSeg(int size ,char* charArr[])

Should be: int ts::genWordSeg(int size ,char* charArr[])
Thanks a lot you both....
Actually these are the only errors that i couldn't find .

Thanks again for your valuable help..
Topic archived. No new replies allowed.