| ID | ... | Creation date | 10 June 2009 |
| Platform | S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition | Tested on devices | Creator IDE V 4.5 and Emulator |
| Category | Qt for Symbian | Subcategory | Application |
| Keywords (APIs, classes, methods, functions): QFileInfo |
QFileInfo class provides system-independent file information.
QFileInfo provides information about a file's name and position (path) in the file system, its access rights and whether it is a directory or symbolic link, etc. The file's size and last modified/read times are also available.
A QFileInfo can point to a file with either a relative or an absolute file path.
str=Info->canonicalFilePath ();
QFileInfo fi("/tmp/archive.tar.gz");
QString base = fi.completeBaseName(); // base = "archive.tar"
#include <QtGui/QApplication>
#include "fileinfo.h"
#include<QFileInfo>
#include<QWidget>
#include<QLabel>
#include<QString>
#include<QVBoxLayout>
#include<QDateTime>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget *win=new QWidget();
QDateTime time;
QFileInfo info("C://demos//launcher//install.txt");
QString str=info.fileName();
time=info.lastModified();
QString str1;
str1=time.toString();
QString ext = info.suffix();
QLabel *lbl=new QLabel(str);
QLabel *lbl1=new QLabel(str1);
QLabel *lbl2=new QLabel(ext);
QVBoxLayout *lay=new QVBoxLayout();
lay->addWidget(lbl);// Name of file "Intall.txt"
lay->addWidget(lbl1);//Last Modified Date
lay->addWidget(lbl2);//File Extension
win->setLayout(lay);
win->show();
return a.exec();
}
More about QFileInfo visit: QFileInfo
More about QFileInfo visit: QFileInfo
Author - User:Mind freak