C prog, null strings question
Hello, I am having a problem determining when a string is empty:
ex: input file "Test1" "Test2" "" "Test4" "Test5" "" "Test7" How can I detect those 2 empty strings? Note: The input has quotes around the letters. #define QUOTES "" int i; while(fscanf(testStream, "%s", &testnum[i]) == 1) i++; for(i=0; i<20; i++) { result = strcmp(QUOTES, testnum[i]); if(result == 0) printf("found string\n"); //print i number of times quotes found. } the above only detects 5 strings, not the other 2. Any ideas? Thank You. |
about this:
Code:
#define QUOTES "" If you want two quotes, then you declare string like this: Code:
const char* str = "\"\""; Code:
#define QUOTES "\"\"" |
Thanks for the help! That fixed it :)
|
All times are GMT -5. The time now is 08:09 PM. |