none
none
Last edited by phlook; 03-15-2009 at 09:04 PM. Reason: reposted
in case it's being wondered,
this if the structure of f_info
Code:struct f_info { int f_blks[4]; int f_scn; int f_frg[64]; };
Hey.
You've declared a pointer to an array that current has no space allocated. You're trying to write to space you haven't allocated in the above code.Code:char *dir_path; ... dir_path = strcat(dir,"/"); dir_path = strcat(dir_path,dp->d_name);
You could use malloc() to initially allocate space, and realloc to reallocate space (to make it bigger). You'd need to free() the space you allocate eventually.
I haven't been having any troubles with dir_path, it seems to be not worrying about allocated space. The biggest issue is that if the filesystem looks like
(root directory)
file1.c
file2.txt
directory
--dfile1.h
--subdirectory
----sdfile1.html
----sdfile2.doc
--dfile2.php
file3.mp3
The traversal will look like:
read file1.c
read file2.txt
open directory
read dfile1.h
attempt to open subdirectory
Error: No such file or directory
// Execution stops here