ANONYMOUS wrote:
> How would I go about adding a relative path to a hashtable without introducing a Segmentation Fault?
>
> Currently, I am able to add directory entries such as program.c, a.x etc to a hashmap and modify them according to modification times but I require some help with adding relative pathnames
>
> For example, subdir1/program.c which has the full pathname dir1/subdir1/program.c
>
> When I attempt to use add_hashtable which is basically the same as the one in lectures I encounter a Segmentation Fault and I am not sure how to diagnose the cause.
There are many different ways to implement hashtables, and all sorts of information may be used as their keys, and stored in them.
The example code provided in our workshop is just one example, but should be able to store all values/lengths of strings.
If you have modified the provided code - permitted, and probably necessary - and it now crashes, then we can't diagnose the problem.
However, the way you've framed the situation is akin to stating "I have a data-structure which stores integers; it works most of the time, except when I attempt to store prime integers".
For our project, file and (sub)directory names are all just strings, and if certain strings crash your program, the problem is very likely in the implementation of the data-structure, and not due to the type/value of what you're trying to store.