from File to LCD help

22 Apr 2011

Hi there,

I am attempting to read from a usb stick and then write to an LCD display, but when the compiler runs, i get the following error:

"Argument of type "std::FILE *" is incompatible with parameter of type "const char *""

I am using the TextLCD library and here is the section of code:

fp = fopen( "/msc/usbTest.txt" , "r" );
    if(fp == NULL)
    {
        lcd.printf("USB mount ERROR: File not read\n");
    }else{
        lcd.cls();
        lcd.printf(fp);
        fclose(fp);

Thanks in advance,

Paul

22 Apr 2011

Hi!

fp is the pointer to the opened file. You can't give that pointer to lcd and say "print everything that is within the file. You have to read a character or line from fp ( fscanf() for example) and this character or string can be passed to lcd.printf().

Regards - Charly

26 Apr 2011

Karl Zweimüller wrote:

Hi!

fp is the pointer to the opened file. You can't give that pointer to lcd and say "print everything that is within the file. You have to read a character or line from fp ( fscanf() for example) and this character or string can be passed to lcd.printf().

Regards - Charly

wow!! Thank you very much!!