Thank you! the "\0" was the problem. strlen (dir) is correct as a length of the string because in this case, dir is actually the directory name plus the file name. All that get_name_from_path does is...
Type: Posts; User: dracayr
Thank you! the "\0" was the problem. strlen (dir) is correct as a length of the string because in this case, dir is actually the directory name plus the file name. All that get_name_from_path does is...
making a local copy of **argv and using that copy would be a workaround I guess, but I'm not sure how to copy **argv
dracayr
Yes, that's exactly what I'm trying to say.
Even if the argv arguments are mutable, how can they change from one point to another with only a parenthesis between them, as shown in the last 4 lines...
the third argument is a pointer to *argv[1]. And I do use it in the two printf() functions near the bottom. Those two printf()s have different output (*argv[1] is changed), and I'm trying to find out...
This is how the function is called:
iterate_dir(argv[2], headers, argv[1]);
headers is a local variable in main()
I only added that last argument, *arg, to the function to debug after I noticed...
hi,
this function:
void iterate_dir(char *dir, struct initrd_file_ptr *headers, char *arg)
{
DIR *directory;
struct dirent *finfo;