Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7163689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:56:41+00:00 2026-05-28T13:56:41+00:00

I have a boost::filesystem::path instance x . I would like to determine whether x

  • 0

I have a boost::filesystem::path instance x. I would like to determine whether x contains any path delimiters in it.

Now, I can simply look for \\ and / in x.string(), but I am interested in the boost way to do it, meaning utilizing the boost::filesystem library, if possible.

Thanks.

EDIT

  1. Let me narrow the problem space. My tool is never going to be run on anything, but the Windows OS.
  2. I have forgotten the drive specifications (c:, etc…). I do not want them either.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:56:41+00:00Added an answer on May 28, 2026 at 1:56 pm

    You can’t.

    But do you really want to? For example c:a contains two path elements c: and a on windows. Why do you need to search for a path delimiter? What makes you think that such a thing exists on all platforms? What is a path delimiter in OpenVMS? E.g. in:

    [a.b.c]a.txt;12
    

    Morale: paths are more complicated beasts than people are used to think. And in fact boost::filesystem::path doesn’t work well anywhere beyond POSIX paths. But this is another story.

    EDIT: assuming that your question is how to check if a path consists of a single element then the answer is, well, count the number of elements:

    boost::filesystem::path p = ...;
    if(std::distance(p.begin(), p.end()) == 1)
        cout << "one element\n";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a certain boost::filesystem::path in hand and I'd like to append a string
In my program I would like to manipulate boost::filesystem::path elements of a vector in
We are using boost::filesystem in our application. I have a 'full' path that is
I have code: std::string firstFile = boost::filesystem::path(first->name()).leaf(); But get error: error conversion from ‘boost::filesystem3::path’
How can I copy a directory using Boost Filesystem? I have tried boost::filesystem::copy_directory() but
I'm exporting some c++ classes to Lua with SWIG. I have declared boost::filesystem::path in
I have a boost::posix_time::ptime that points to March 31st 2010 like this: ptime p(date(2010,
I'm trying to use boost::filesystem to copy files and folders (just like a standard
I'm using boost filesystem to replace windows C++ functions like CopyFile and MoveFile to
I have the following code which i m trying to compile: #include <boost/filesystem/convenience.hpp> #include

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.