Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 2 months ago.
Can't use mbed_file_handle
The documentation for the FileHandle API mentions the function: FileHandle *mbed_file_handle(int fd) that I would like to use. But the compiler does not know this function. On github it is found in platform/mbed_retarget.h. I need it in order to check if stdin (a tty) is readable.
1 Answer
5 years, 2 months ago.
Hi Ad,
Are you using LittleFileSystem or FATFileSystem? I would recommended you to study FileSystem documentation and maybe use some other way to check if stdin is readable. https://os.mbed.com/docs/mbed-os/v5.14/apis/filesystem.html
Regards, Pekka
None of those, I try to get a FileHandle for the default serial port which is connected to stdin/stdout. Please have look at this page: https://os.mbed.com/docs/mbed-os/v5.14/apis/filehandle.html at the section "Mapping between API's". It reads "The only call provided to map from higher level to lower-level is:
FileHandle *mbed_file_handle(int fd) obtain the FileHandle for a POSIX file descriptor". Through the FileHandle I can call readable() on stdin. That way I don't need to create an explicit Serial object which is less portable because of the necessity for pinnames.
posted by 01 Nov 2019