C
collinm
hi
i would like to return a string
in my block main i do:
printf("%s\n",readFiletmp_mnt_dir_led, mnt_dir_led,
"B_L1_HLD_GRN_NOR_Run_Counter.txt"));
i see some crap character
are there any way to do resolve this problem in C?
thanks
i would like to return a string
Code:
char *readFile(char *tmp_dir_led, char *directory, char *filename)
{
FILE *fp;
char line[LINE_MAX];
snprintf(tmp_mnt_dir_led, sizeof(tmp_mnt_dir_led),"%s/%s",
directory,filename);
fp = fopen(tmp_mnt_dir_led, "r");
if(fp!=NULL)
{
fgets(line, LINE_MAX, fp);
}
return line;
}
in my block main i do:
printf("%s\n",readFiletmp_mnt_dir_led, mnt_dir_led,
"B_L1_HLD_GRN_NOR_Run_Counter.txt"));
i see some crap character
are there any way to do resolve this problem in C?
thanks