Click here to Skip to main content
15,889,838 members

Response to: strcmp is not working the way it should

Revision 1
Working just from your code fragment, it is difficult to work out what your problem is: the only reference to strcmp you have does not use argv at all - it uses an array of strings you create and fill.

But are you sure you are using it right?
C++
strcmp(argument[0], "cd")

will return 0 if the strings are the same, so
C++
if (!strcmp(argument[0], "cd"))
  changeDirectory(buffer,i);
will change the directory if the arguement is not "cd"

I don't think that is quite what you intended...

Use the debugger - step through you code and see what is going on. It's a lot easier and quicker that asking here - particularly if you don't give us the right info! :laugh:
Posted 11-Jan-13 1:36am by OriginalGriff.
Tags: