Skip to main content
Associate
Jul 29, 2024 12:31 PM UTC
Question

read text from a file

Hi,

I would like to read text from a file csv and maybe display it, is it possible?

thanks

This topic has been closed for replies.

5 replies

Andrew Neil
Super User
Jul 29, 2024 12:51 PM UTC

Yes.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Tesla DeLorean
Guru
Jul 29, 2024 4:03 PM UTC

The file would need to exist somewhere, be it an SD Card, eMMC or QSPI.

You'd need a file system, and a block driver. Something like FATFS or X-FILE

You'd need to read and parse the data in small amounts, or buffer and break into lines. Basic STDIO file handling type stuff, like on a PC application, but using f_open/f_read/f_close variants furnished by your file system

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
GaetanGodart
ST Employee
Jul 29, 2024 4:12 PM UTC

Hello @ab73 ,

 

Yes it is possible.

Just look at how to read a data file in C ("C read file" on Google).

From there you can fetch your data and display it on a textArea widget for instance.

Please find here our guide on how to display dynamic data on a textArea!

 

If this comment or another one answers your question, I invite you to select the most helpful comment as "best answer".

 

Regards,

Gaetan GodartSoftware engineer at ST (TouchGFX)
Tesla DeLorean
Guru
Jul 29, 2024 4:49 PM UTC

File IO seems like some that would need to be part of the TouchGFX builds or demos, given the value and foot-print of such a use case?

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
GaetanGodart
ST Employee
Sep 2, 2024 9:09 AM UTC

Hello @ab73 ,

Have you been able to solve your problem?
If so, I invite you to select the most helpful comment as "best answer".

Regards,

Gaetan GodartSoftware engineer at ST (TouchGFX)