Hello. I am new to this forum and hoping to find an answer to my problem. My lecturer at college is not quite doing what he is supposed to, and doesn't want to explain to us what certain commands do. My first question is What does strcmp() and strtok() do, and what's the right way to use them.
Then he asked us to write a C code to simulate the Command Prompt console that we can get in windows. Started off with an easy (i thought) one. Here is the code that I have, but it is not doing what I want it to do. It should be working like the "dir" command in cmd:
I am problably using strtok wrong, so any feedback is really appreciated. Also hints as to how to tackle a CD command, would be useful.
#include <stdio.h>#include <stdlib.h>
void cmdcom(char dirname)
struct dirent *ent;
dir = opendir(dirname);