The C language does not know strings. You cannot assign strings using the = operator in C.
A STRPTR is a pointer to an array of characters. By assigning fileName to fib_FileName you let the pointer point to a part of the memory you allocated using AllocDosObjects before. Later you free that memory so that fileName now points to memory which is no longer valid.
What you have to do is
fl->fileName = malloc(strlen(fib->fib_FileName)+1);
strcpy (fl->fileName,fib->fib_FileName);
|