hi
i need to read a list of file names from a txt file into an array. i am getting some weird error i think it is caused by me not understanding properly how to deal with pointers. This is the code :
///////////////
STRING* cabezaSkins[10];
filehandle = file_open_read("skins_cabeza_cfg.txt");
if (filehandle != 0)
{
STRING* file = "";
var i;
for (i = 0; i < 10; i++)
{
file_str_read(filehandle, file);
cabezaSkins[i] = file;
}
}
file_close(filehandle);
//////////////////////////
when the loop finishes all files are the same as the last one. It seems to me that when I do cabezaSkins[i] = file; they point to the same part of memory (file pointer). I need to get the actual string which is different in each loop into its array position. I tried doing str_cpy(cuerpoSkins[i], file); but this crashes the appplication on startup.
So the question is, how do i get the actuall string out of the STRING* pointer and copy it into another pointer, or better into a position inside an array of string pointers?
is there any tutorial on this kind of issues, i find strings and arrays of pointers really confusing. I have done some C++ recently but not enough i guess.
thanks
enrike
Last edited by enrike; 12/10/09 08:59.