im trying to fill a 2d array with strings, problem is that i manage to fill the first index, however when i proceed to the next string it keeps changing the previous indexes. probably an issue with the pointer, this is the relevant code.
char* get_song_name(const char* song)
{
strip(song);
FILE* fp = fopen(song, "r");
char str[9999];
while(!feof(fp))
{
fgets(str,9999,fp);
puts(str);
strip(str);
char* s = str;
return s;
}
` DIFFERENT FUNCTION:
for(i=0;i<lines;i++)
{
char *st = fgets(buff, 250, fp);
st = create_path("c:\\Users\\Marian\\Desktop\\beatles", st);
name[i] = get_song_name(st); //WORKS HOWEVER CHANGES PRVIOUS INDEXES VALUE TOO
}`