parsing funtional args

Hi all,

In one of my assement I need to parse a function.

E.g:
struct
{
char a;
string s;
}mystruct;

int get(int a, long b, mystruct t);

the above function decleration is given to me. I need to pasre the above funtion and keep it in my local.

When user sends a message i need to parse the message and I need to call the funciton.

How to for the args list.
After parsing the args list, i should get the below information

args[0] = int
args[1] = long
args[2] = mystruct

once the above list is prepared, i need to allocate memory and I need to assign the values to them.


It is something like a structure needs to store both premitive and user defined data type.

Kindly guide me...
That's easy! Exctept that args[0] is the function call parameter eg.
1
2
3
4
5
6
#include <iostream>

int main(int argc, char* argv[])
{
      std::cout<<argv[0];
      }

Try it and you see it's the file path to your program's exe.
So, you need argv[1], argv[2] and argv[3].
for the int and long use atoi and atol, but for the mystruct, I'll need to see an example, becouse I don't know the format!
Last edited on
Topic archived. No new replies allowed.