PDA

View Full Version : How to get just the filename from full file path?



DiamonDogX
18th May 2009, 21:46
If I have a file path like C:/temp/foo.txt, is there a convenient, proper, cross-platform way to extract just the "foo.txt" part? Thx.

wysota
18th May 2009, 22:19
QFileInfo::fileName()

jano_alex_es
19th May 2009, 09:30
and with QString you can use QString::lastIndexOf(), QString::rightJustified() and QString::size()