There is someting strange I've noticed when debugging code that use struct
If you consider the follwing piece of code, which prints the name of all files
in the directory /home/foo
struct dirent *dp;
dfd = opendir("/home/foo);
while ((dp = readdir(dfd)) != NULL)
It works well (I haven't provided any error checking because it is notQuote:}
relevant to my question) but if I set a breakpoint after dp has been
initialized, for instance, right before the call to printf and check the
value of dp->d_name, I get garbage.
Am I missing something?
"So if you meet me, have some courtesy, have some sympathy, and some taste
Use all your well-learned politesse, or I'll lay your soul to waste"
- The Rolling Stones, "Sympathy for the Devil"