Thread: How to judge whether a path is relative or absolute?

  1. #1
    Why bbebfe is not bbebfe? bbebfe's Avatar
    Join Date
    Nov 2008
    Location
    Earth
    Posts
    27

    Question How to judge whether a path is relative or absolute?

    As the title, is there a function in GNU C library?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    It begins with a dot.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    I am not entirely sure, but I believe that a simple check for a leading '/' or a drive label like 'C:' would suffice, depending on platform, of course.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get relative mouse coordinates when GLUT return absolute
    By joeprogrammer in forum Game Programming
    Replies: 14
    Last Post: 02-10-2009, 06:35 PM
  2. MSVC: output .pd under relative path?
    By pheres in forum Windows Programming
    Replies: 0
    Last Post: 02-04-2008, 10:55 AM
  3. Path of file relative to program
    By ulillillia in forum C Programming
    Replies: 13
    Last Post: 04-15-2007, 05:30 AM
  4. how to obtain the absolute application path
    By jagerhans in forum Linux Programming
    Replies: 4
    Last Post: 12-23-2004, 05:48 PM
  5. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM