Unsolved How to read data from the usb drive?
-
I'd like to read data from a USB drive which is connected to the embedded Linux board or normal PC USB Port.
-
Hi,
It is very easy, u just have to use FolderListModel, here official doc:
http://doc.qt.io/qt-5/qml-qt-labs-folderlistmodel-folderlistmodel.html
LA -
As any other file in any other place you can use QFile
-
@VRonin I have used that to copy files to the USB but now I want to read those files from USB I mean I don't want to copy back to PC I just wanna see what is inside that folder.
-
Yep, that's what QFile, QDir and friends do
-
@VRonin But i can't read those files its just like moving them to one place to another with QFile. I want to read file this time but.
-
QFile myFileOnUSB("D:/FolderOnUSBDrive/someFile.txt"); if(myFileOnUSB.open(QFile::ReadOnly | QFile::Text)){ QTextStream textReader(&myFileOnUSB); QString line; while (textReader.readLineInto(&line)) qDebug() << line; }