Results 1 to 4 of 4

Thread: How to write file in the selected path.

  1. #1
    Join Date
    Jan 2007
    Posts
    326
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default How to write file in the selected path.

    Hi all

    Me working on Qt4.2 for MAC O.S

    Can anybody tells me that how can I write my own file in the selected path from the QFiledialog through Qt Programming;

    Thanx
    Always Believe in Urself
    Merry

  2. #2
    Join Date
    Jan 2007
    Posts
    326
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to write file in the selected path.

    Hi

    For eg.

    Qt Code:
    1. FILE *fh = NULL;
    2. fh=fopen("/path","wb+");
    To copy to clipboard, switch view to plain text mode 
    the above file named "path" is created in the harddisk.

    but I want to create this file on that path selected by me using QFiledialog which is stored in a string.


    Qt Code:
    1. QString m_dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
    2. "/home",
    3. QFileDialog::ShowDirsOnly
    4. |QFileDialog::DontResolveSymlinks);
    To copy to clipboard, switch view to plain text mode 
    Always Believe in Urself
    Merry

  3. #3
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: How to write file in the selected path.

    Hi,

    you can do like this.

    QString FileName= QFileDialog::getSaveFileName(this,"",Save","YrFile Name","");

    fopen((const char*)FileName.toAscii() ,"wb+")

    It will save the file YrFileName to the selected Path

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to write file in the selected path.

    QFile - do I need to say more?
    J-P Nurmi

Similar Threads

  1. FSWriteFork in MAC OS to write data to a file.
    By vishal.chauhan in forum General Programming
    Replies: 5
    Last Post: 2nd July 2007, 06:48
  2. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21
  3. who can give me a tutorials of write .pro file
    By fengtian.we in forum Qt Programming
    Replies: 5
    Last Post: 20th May 2007, 16:25
  4. getting absolute file path of Qt resources
    By dvmorris in forum Qt Programming
    Replies: 6
    Last Post: 18th April 2007, 02:56
  5. Replies: 12
    Last Post: 7th February 2007, 13:30

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.