Results 1 to 9 of 9

Thread: how to get the list of files without their extensions in a specified directory in Qt

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Join Date
    Nov 2007
    Posts
    55
    Thanks
    1
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to get the list of files without their extensions in a specified directory in

    use the truncate() method of QString

    Qt Code:
    1. QString fileName("myFile.new.txt");
    2. qDebug() << fileName; // myFile.new.txt
    3. fileName.truncate(fileName.lastIndexOf('.'));
    4. qDebug() << fileName; // myFile.new
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to alainstgt for this useful post:

    sliverTwist (3rd April 2013)

Similar Threads

  1. List all XML files in a directory
    By ouekah in forum Newbie
    Replies: 4
    Last Post: 30th August 2015, 08:47
  2. Replies: 1
    Last Post: 27th December 2012, 06:01
  3. How to list the ftp directory in tree widget?
    By Gokulnathvc in forum Newbie
    Replies: 4
    Last Post: 18th October 2012, 05:08
  4. How to get a list of file names in a directory?
    By khanhsk in forum Qt Programming
    Replies: 2
    Last Post: 8th February 2012, 02:34
  5. directory and files
    By rmagro in forum Qt Programming
    Replies: 2
    Last Post: 16th September 2008, 13:40

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.