File class documentation - where is it ?

Hello, I'm trying to use the File class and really need some documentation. I'm using the SD example code in ListFiles sketch

         File entry =  dir.openNextFile();
        if (! entry)
        {
            // no more files
             Serial.println("**nomorefiles**");
            break;    // Finished !!
     }
     
     Serial.println(entry.name());

However, I want to copy the file name returned by entry.name() rather than print it to the Serial monitor but can't find any documentation on using the class File.

Any help would be appreciated

Did you look in File.cpp in the SD directory?

entry.name() returns a pointer to a string. strcpy() or strdup() depending on whether you have allocated space already, or not.

PaulS:
Did you look in File.cpp in the SD directory?

entry.name() returns a pointer to a string. strcpy() or strdup() depending on whether you have allocated space already, or not.

Hi Paul,
Thanks for the reply !

I have tried

    char* pBuff;
     pBuff = entry.name;

... but I get a compiler error on the last line
"argument of type 'char* (File::)()' does not match 'char*' "
Hence my " problem "/ confusion !!

Remittub:

PaulS:
Did you look in File.cpp in the SD directory?

entry.name() returns a pointer to a string. strcpy() or strdup() depending on whether you have allocated space already, or not.

Hi Paul,
Thanks for the reply !

I have tried

    char* pBuff;

pBuff = entry.name;




... but I get a compiler error on the last line 
"argument of type 'char* (File::)()' does not match 'char*' "
Hence my " problem "/ confusion !!

STUPID ME !! Left off the () after " entry.name" !! It's always the simple things !!!!

Thanks all for sharing my suffering/ stupidity !!!

... but I get a compiler error on the last line

Well, of course you do. entry.name is a function. entry.name() is a call to a function that returns a value.

Making a copy of the pointer returned, as you are trying to do, will be a waste of time. When the pointed to value changes for one copy of the pointer, the pointed to value for the other will change, too.

strcpy() copies the pointed to data. strdup() creates another pointer, and memory that it points to, and copies the pointed to data there.