hello all, Im trying to make a command line parser and honestly am having trouble starting it. I need a function called parse which reads one line of user input and creates an array of the strings found in the input. the function should be passed the array and reference variable that is to be the length of the array. Prompt the user and read the input from within the parse function.
example if the user types " cp this that" the resulting array will have length 3 and contain strings "cpp", "this", and "that"
then i have to creat a main function that will continueously loop until the user enters quit as an input.
heres what I have so far.
/************************************************************************
Command Line Parser
Version 1.0
This program parses a user input and places it into arrays in C++
Source File: cmdParser.cpp
*************************************************************************/
#include <iostream>
using namespace std;
int parse( char array[], int length)
{
char ch;
cout << " Please enter a command " << endl;
cin.get(ch);
while ( !cin.eof() )
if ( isspace(ch) )
}
int main()
{
int length;
int array[length];
if ( ??? != quit)
{
parse(array, length);
}
}