I seem to have a syntax error on the line
FSFILE *file;
in the following code after adding the sprintf() line. The code worked up until i added the char text, textresult and sprintf(). I can't seem to find out what's wrong with it. I'm using the C18 compiler. the code is for writing data to an SD card using SPI. the char txt[] is a value from a measurement with a temperature sensor, for example: 23,5. But I want to add more text to this. The goal is to store every 5 minutes a measurement on the SD card, along with a timestamp or something. i'm using a PIC18f27j53.
void writeFile()
{
unsigned char txt[]={ftc(result,0),ftc(result,1),0x2C,ftc(result,3)};
unsigned char text[]= "hello";
unsigned char textresult[];
sprintf(textresult, "%c%c", txt, text);
//unsigned char size = sizeof(result)-1;
FSFILE *file;
file = FSfopenpgm("DATA.TXT", "w");
if(file == NULL)while(1);
if(FSfwrite((void *) txt, 1, 4, file)!=4)while(1);
if(FSfclose(file)!=0)while(1);
}