Get Current File Name

This is a discussion on Get Current File Name within the C++ Programming forums, part of the General Programming Boards category; I'm building a notepad application using the QT libraries. I am looking for a way to create a "save" function. ...

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    3

    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:

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

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    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, 03: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, 11:56 PM
  5. Detecting the current instance of exe file
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 09-03-2001, 09:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21