Thread: Get Current File Name

  1. #1
    Registered User
    Join Date
    Apr 2011

    Post Get Current File Name

    I'm building a notepad application using the QT libraries. I am looking for a way to create a "save" function. I have the "save as..." function working because I figured out how to get the dialog to come up and then choose where to save it. But now I want to create just a plain 'save' button that doesn't ask where to save, it just saves to its current file.

    I just need to know how to grab the opened file's name and just substitute that for the [code]QFileDialog::getopenfilename()[code]...

    Pseudocode would be something like:

    QString saveName=(this File's Name);
    save file without asking under saveName;

  2. #2
    Join Date
    Aug 2010
    Ontario Canada
    Why wouldn't you just save it in a string when you open the file?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get the current directory and the file name
    By megareix in forum Windows Programming
    Replies: 6
    Last Post: 01-08-2009, 10:01 PM
  2. How to store file in current directory
    By jk1998 in forum C++ Programming
    Replies: 2
    Last Post: 05-11-2007, 02:18 PM
  3. Getting a string with the name of the current file
    By Jasel in forum C++ Programming
    Replies: 1
    Last Post: 02-23-2004, 08:48 AM
  4. File I/O with a current Date
    By Kyoto Oshiro in forum C++ Programming
    Replies: 4
    Last Post: 07-12-2002, 10:56 PM
  5. Detecting the current instance of exe file
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 09-03-2001, 08:22 PM