Hi!
I'm writing a function which returns some string.
Here's the code:
Code:
char *Text (char File[])
{
FILE *fin = NULL;
short Lines = 0, j=0;
char Character, temp1[100], temp2[100], *temp1kaz, *temp2kaz, temp3[100], *temp3kaz;
strncpy (File, "./DATA/LANGUAGE/sc.lng", sizeof ("./DATA/LANGUAGE/sc.lng"));
if ((fin = fopen (File, "rt")) != NULL)
{
temp1kaz = temp1;
temp2kaz = temp2;
temp3kaz = temp3;
while (fscanf (fin, "%c", &Character) != EOF)
{
if (Character == '#') Lines++;
if (Lines == 5)
{
j++;
if (j >= 7)
{
*temp3kaz = Character;
temp3kaz++;
}
}
*temp3kaz = '\0';
}
fclose (fin);
return temp3;
}
else
{
return NULL;
}
}
But I get a warning message which I can't solve it. This is the warning message "warning C4172: returning address of local variable or temporary". What to do??