J
J Wang
dear,
I debug the program recently as follows.
#include <sys/stat.h>
int main(int argc, char *argv[])
{
struct stat buf;
stat(argv[1], &buf);
...
return 0;
}
int main(int argc, char *argv[])
{
struct stat *buf;
stat(argv[1], buf);
...
return 0;
}
what is the difference with them?
why I have to modify 2nd program like this:
{
struct stat temp, *buf = &temp;
stat(argv[1], buf);
...
}
many thanks
I debug the program recently as follows.
#include <sys/stat.h>
int main(int argc, char *argv[])
{
struct stat buf;
stat(argv[1], &buf);
...
return 0;
}
int main(int argc, char *argv[])
{
struct stat *buf;
stat(argv[1], buf);
...
return 0;
}
what is the difference with them?
why I have to modify 2nd program like this:
{
struct stat temp, *buf = &temp;
stat(argv[1], buf);
...
}
many thanks