Results 1 to 4 of 4

Thread: local file path

  1. #1
    Join Date
    Dec 2010
    Posts
    44
    Thanks
    9
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default local file path

    Hi All,

    In my application I need to write out some file paths for an independent application to read and process. And I want to do it in a cross platform way. Which is to say:

    If "home/sk/sk.dat" is the path to sk.dat then I want to write out:


    1. On Linux : "home/sk/sk.dat"

    2. On win : "home\sk\sk.dat"

    Is there any QT Util which can do this automatically ?

    Thanks in advance,
    sky

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: local file path


  3. The following user says thank you to Lesiok for this useful post:

    sky (19th January 2011)

  4. #3
    Join Date
    Dec 2010
    Posts
    44
    Thanks
    9
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: local file path

    Thank You Lesiok. I wonder how I missed it!

  5. #4
    Join Date
    Nov 2010
    Location
    Budapest, Hungary
    Posts
    125
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: local file path

    the first works for me on Win XP and Ubuntu-Linux also. Even for the non-Qt ifstream/ofstream file handling mode, I tried it for FILE* also, but that failed, but that was just for being curious. But since than I'm not counting disappearing backslashs any more... (Well, it might be still not as correct as this nativeSeparator version, but works.)
    Szilvi

Similar Threads

  1. Phonon and buffer of local file
    By alexandernst in forum Qt Programming
    Replies: 6
    Last Post: 28th November 2012, 09:15
  2. QDesktopServices open url & local file & pdf or doc
    By patrik08 in forum Qt Programming
    Replies: 9
    Last Post: 14th April 2012, 04:42
  3. Replies: 1
    Last Post: 22nd December 2010, 17:56
  4. Replies: 4
    Last Post: 22nd June 2010, 10:59
  5. Password on local file/folder
    By icebox25 in forum Qt Programming
    Replies: 3
    Last Post: 13th April 2007, 16:33

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.