Use memset...
memset(fileName, 0, MAX_PATH);
Rewrites the elements to 0.
Yiuca
Junior Poster in Training
89 posts since Sep 2008
Reputation Points: 60
Solved Threads: 17
Keep it simple:
fileName[0] = '\0';
// or even
*fileName = 0;
// to test:
if (*fileName) { // non-empty
;)
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
How would I test if it IS empty.
Because I am currently using: if (fileName == "")
And I am using this for over 6 if statments.
Didn't you familiar with logical not operator?
if (!*fileName)
// or
if (fileName[0] == '\0')
// or
if (strlen(fileName) == 0)
By the way, fileName == "" is equal tofalse in all cases. Why? Think about pointers comparison ;)
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348