Max Path [Newbie]

Discussion in 'C++' started by Rookie, Sep 24, 2004.

  1. Rookie

    Rookie Guest

    I was just wondering whether there is any MAX_PATH macro in C\C++? If not
    what is a safe value to assume for maximum path length?
     
    Rookie, Sep 24, 2004
    #1
    1. Advertising

  2. Rookie

    David Hilsee Guest

    "Rookie" <> wrote in message
    news:cj05jn$k3b$...
    > I was just wondering whether there is any MAX_PATH macro in C\C++? If not
    > what is a safe value to assume for maximum path length?


    If you're asking about a constant that defines the largest value that some
    file's path may have on the filesystem, then you should ask this question on
    a newsgroup that discusses your platform. AFAIK, there is no macro named
    MAX_PATH in standard C or C++. If you're on Windows, then Microsoft's MSDN
    or Microsoft-specific newsgroups may be useful.

    --
    David Hilsee
     
    David Hilsee, Sep 24, 2004
    #2
    1. Advertising

  3. Rookie

    Jack Klein Guest

    On Fri, 24 Sep 2004 00:07:24 -0400, "David Hilsee"
    <> wrote in comp.lang.c++:

    > "Rookie" <> wrote in message
    > news:cj05jn$k3b$...
    > > I was just wondering whether there is any MAX_PATH macro in C\C++? If not
    > > what is a safe value to assume for maximum path length?

    >
    > If you're asking about a constant that defines the largest value that some
    > file's path may have on the filesystem, then you should ask this question on
    > a newsgroup that discusses your platform. AFAIK, there is no macro named
    > MAX_PATH in standard C or C++. If you're on Windows, then Microsoft's MSDN
    > or Microsoft-specific newsgroups may be useful.


    Nonsense, there is a perfectly valid solution, defined by standard C
    and inherited by standard C++.

    Look up the macro FILENAME_MAX defined in <stdio.h> and <cstdio>.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
     
    Jack Klein, Sep 24, 2004
    #3
  4. Rookie

    David Hilsee Guest

    "Jack Klein" <> wrote in message
    news:...
    > On Fri, 24 Sep 2004 00:07:24 -0400, "David Hilsee"
    > <> wrote in comp.lang.c++:
    >
    > > "Rookie" <> wrote in message
    > > news:cj05jn$k3b$...
    > > > I was just wondering whether there is any MAX_PATH macro in C\C++? If

    not
    > > > what is a safe value to assume for maximum path length?

    > >
    > > If you're asking about a constant that defines the largest value that

    some
    > > file's path may have on the filesystem, then you should ask this

    question on
    > > a newsgroup that discusses your platform. AFAIK, there is no macro

    named
    > > MAX_PATH in standard C or C++. If you're on Windows, then Microsoft's

    MSDN
    > > or Microsoft-specific newsgroups may be useful.

    >
    > Nonsense, there is a perfectly valid solution, defined by standard C
    > and inherited by standard C++.
    >
    > Look up the macro FILENAME_MAX defined in <stdio.h> and <cstdio>.


    I assumed that the original question was about a macro named MAX_PATH and
    inferred that Rookie was asking about Windows. My apologies if I assumed
    incorrectly. According to MSDN, on Windows, MAX_PATH is 260 characters, and
    so is FILENAME_MAX. Rookie would have to provide more information to know
    if what he is doing is platform-specific.

    --
    David Hilsee
     
    David Hilsee, Sep 24, 2004
    #4
  5. Rookie

    Rookie Guest

    I am working on a UNIX platform. I had a vague idea of some MAX_PATH (or
    MAXPATH) macro in Windows. But I justed wanted to know how I would do it in
    UNIX. But I guess the FILENAME_MAX macro is platform independent and works
    well enough. Anyways thanks to both of you guys for your replies!

    "David Hilsee" <> wrote in message
    news:...
    > "Jack Klein" <> wrote in message
    > news:...
    >> On Fri, 24 Sep 2004 00:07:24 -0400, "David Hilsee"
    >> <> wrote in comp.lang.c++:
    >>
    >> > "Rookie" <> wrote in message
    >> > news:cj05jn$k3b$...
    >> > > I was just wondering whether there is any MAX_PATH macro in C\C++? If

    > not
    >> > > what is a safe value to assume for maximum path length?
    >> >
    >> > If you're asking about a constant that defines the largest value that

    > some
    >> > file's path may have on the filesystem, then you should ask this

    > question on
    >> > a newsgroup that discusses your platform. AFAIK, there is no macro

    > named
    >> > MAX_PATH in standard C or C++. If you're on Windows, then Microsoft's

    > MSDN
    >> > or Microsoft-specific newsgroups may be useful.

    >>
    >> Nonsense, there is a perfectly valid solution, defined by standard C
    >> and inherited by standard C++.
    >>
    >> Look up the macro FILENAME_MAX defined in <stdio.h> and <cstdio>.

    >
    > I assumed that the original question was about a macro named MAX_PATH and
    > inferred that Rookie was asking about Windows. My apologies if I assumed
    > incorrectly. According to MSDN, on Windows, MAX_PATH is 260 characters,
    > and
    > so is FILENAME_MAX. Rookie would have to provide more information to know
    > if what he is doing is platform-specific.
    >
    > --
    > David Hilsee
    >
    >
     
    Rookie, Sep 24, 2004
    #5
  6. "Jack Klein" <> wrote in message
    > On Fri, 24 Sep 2004 00:07:24 -0400, "David Hilsee"
    > <> wrote in comp.lang.c++:
    >
    > > "Rookie" <> wrote
    > > > I was just wondering whether there is any MAX_PATH macro in C\C++? If

    not
    > > > what is a safe value to assume for maximum path length?

    > >
    > > If you're asking about a constant that defines the largest value that

    some
    > > file's path may have on the filesystem, then you should ask this

    question on
    > > a newsgroup that discusses your platform. AFAIK, there is no macro

    named
    > > MAX_PATH in standard C or C++. If you're on Windows, then Microsoft's

    MSDN
    > > or Microsoft-specific newsgroups may be useful.

    >
    > Nonsense, there is a perfectly valid solution, defined by standard C
    > and inherited by standard C++.
    >
    > Look up the macro FILENAME_MAX defined in <stdio.h> and <cstdio>.
    >

    This is a real-world problem if you ask me
    I don't think FILENAME_MAX would be the same as PATH_MAX.
    Take Windows for example: if a filename can be 255 chars, Then a path name
    can be many thousands chars.
    I think we have a real problem of no standard way to determine the legal
    maximum file path length. However this is file-system dependent and I think
    a good file-system may well say: I file's path can be any length !

    Timothy Madden
    Romania
    --------------------------------------------
    And I don't wanna miss a thing
     
    Timothy Madden, Sep 24, 2004
    #6
  7. Rookie

    Jeff Flinn Guest

    "Rookie" <> wrote in message
    news:cj0ae3$nb8$...
    > I am working on a UNIX platform. I had a vague idea of some MAX_PATH (or
    > MAXPATH) macro in Windows. But I justed wanted to know how I would do it

    in
    > UNIX. But I guess the FILENAME_MAX macro is platform independent and works
    > well enough. Anyways thanks to both of you guys for your replies!


    Size shouldn't matter. :) Avoid the issue altogether by using
    boost::filesystem at www.boost.org.

    Jeff F
     
    Jeff Flinn, Sep 24, 2004
    #7
  8. * Jack Klein:
    > On Fri, 24 Sep 2004 00:07:24 -0400, "David Hilsee"
    > <> wrote in comp.lang.c++:
    >
    > > "Rookie" <> wrote in message
    > > news:cj05jn$k3b$...
    > > > I was just wondering whether there is any MAX_PATH macro in C\C++? If not
    > > > what is a safe value to assume for maximum path length?

    > >
    > > If you're asking about a constant that defines the largest value that some
    > > file's path may have on the filesystem, then you should ask this question on
    > > a newsgroup that discusses your platform. AFAIK, there is no macro named
    > > MAX_PATH in standard C or C++. If you're on Windows, then Microsoft's MSDN
    > > or Microsoft-specific newsgroups may be useful.

    >
    > Nonsense, there is a perfectly valid solution, defined by standard C
    > and inherited by standard C++.
    >
    > Look up the macro FILENAME_MAX defined in <stdio.h> and <cstdio>.


    One should perhaps add that using that constant will not necessarily
    allow access to all files and directories on the given system.

    For example, the maximum path length for a Unicode path in Windows is
    about 32.000 characters (I suspect the actual value is close to 2^15, but
    the documentation is vague, as always), whereas FILENAME_MAX might give
    a value in the low three-digit range.

    Don't know whether boost::filesystem handles that sort of thing, and if so,
    how.

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is it such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet and in e-mail?
     
    Alf P. Steinbach, Sep 24, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. john
    Replies:
    41
    Views:
    1,225
    Chris Theis
    Jan 22, 2004
  2. Rookie

    Max Path [Newbie]

    Rookie, Sep 24, 2004, in forum: C Programming
    Replies:
    23
    Views:
    983
    Dan Pop
    Oct 6, 2004
  3. Summercool
    Replies:
    9
    Views:
    902
    dorayme
    Oct 23, 2007
  4. Greg Ferris

    Textarea max rows and max characters per row

    Greg Ferris, Jan 16, 2004, in forum: Javascript
    Replies:
    2
    Views:
    607
    Greg Ferris
    Jan 16, 2004
  5. kriton
    Replies:
    0
    Views:
    347
    kriton
    Apr 22, 2005
Loading...

Share This Page