Hi
As a Java programmer who wants to learn C, I try to create a command line based menu in C. The menu should read a line that is split by spaces that are divided into a matrix. Below are some Java code that does what I want: Can someone please help me to create a menu in C with this functionality?
while(scan.hasNextLine()) {
String line = scan.nextLine();
String [] command = line.split(" ");
if(command[0].equals("c") && command[1] != null) {
......
C:
char line[LINE_MAX];
char *command;
if(fgets(line, LINE_MAX, stdin) != NULL) {
command = strtok(line," ");
while(command != NULL) {
printf("%s", command);
}
}