Print statement never executed
Print statement never executed
./getdata long ========================================= Code:
#include <stdio.h> |
actually the problem is the line above, you cant compare strings like that, refer to this thread http://www.linuxquestions.org/questi...590#post422590 the required modification is
if( argc == 2 && !strcmp(parameter1, "long")) strcmp is defined in string.h |
to kev82
Hi. the statement below
if( argc == 2 && !strcmp(parameter1, "long")) When there is two argument and parameter1 is equal to long. That is what I mean. An ! (exclamation) means parameter1 is not equal to long, when in fact it is. When I used an ! , the condition is met. When I leave out an !, the condition is never met. Please explain. An ! means it should not equal, when in this case it is. |
as the man page states, strcmp returns 0 if the strings are equal, non-zero otherwise. so !strcmp returns 0 if there not equal, and non-zero if they are equal.
|
All times are GMT -5. The time now is 12:03 PM. |