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 8429135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:15:01+00:00 2026-06-10T05:15:01+00:00

I successfully compile the program at the Question How to pass a string type

  • 0

I successfully compile the program at the Question How to pass a string type path to boost::filesystem:path's constructor? However, the output result shows more than the expected one.

Folder status: 0
Bus error: 10

The first line is the only expected result. I do not understand why the second one comes?

I get the following debug information by gdb:

(gdb) run
Starting program: /Users/ZL/Desktop/mtfsg 
Reading symbols for shared libraries ++++............................. done
Folder status: 0

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5fc005a0
0x00007fff9046aab7 in std::basic_string<char, std::char_traits<char>, 
std::allocator<char>>::~basic_string ()
(gdb) bt
#0  0x00007fff9046aab7 in std::basic_string<char, std::char_traits<char>, 
std::allocator<char> >::~basic_string ()
#1  0x00000001000018dd in main () at m.cpp:12
  • 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-06-10T05:15:02+00:00Added an answer on June 10, 2026 at 5:15 am

    Finally, I find the point of the error in my code:

    In class OSxFS (tfs.h file), the method “string ShowStatus()” has an incorrect return type “string”. This method does not need a return value since its functionality is only to print the directory (folder) status on the screen. So, I replace the “string” return type by “void”.

    The original code of method “string ShowStatus()”

    **string** ShowStatus()
        {
          boost::filesystem::file_status folderStatus =
           boost::filesystem::status(mFolderPath);
    
          try
          {
            cout<<"Folder status: "<<boost::filesystem::is_directory(folderStatus)<<endl;
          }
          catch(boost::filesystem::filesystem_error &e)
          {
            cerr<<"Error captured: "<<e.what()<<endl;
          }
        }
    

    The correct code:

    **void** ShowStatus()
        {
          boost::filesystem::file_status folderStatus = 
           boost::filesystem::status(mFolderPath);
    
          try
          {
            cout<<"Folder status: "<<boost::filesystem::is_directory(folderStatus)<<endl;
          }
          catch(boost::filesystem::filesystem_error &e)
          {
            cerr<<"Error captured: "<<e.what()<<endl;
          }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My program will not successfully compile in /MT (MultiThreaded) mode. It Compiles in /MD
I have a reasonably simple C++ program that I can successfully compile on OSX
The section of code in question is: String fileToCompile = C:/Users/Jeff/Documents/Test/Compiler 6/examplejavafile.java;//Absolute path JavaCompiler
I successfully compiled the following program simple.cc: #include <gtkmm.h> int main (int argc, char
I have my program written in C++ and it is can be successfully compiled
I wrote my first program in Haskell today. It compiles and runs successfully .
I've got some sample project. When i run it on my machine, successfully compile
I do tutorial in following link: Java RMI Tutorial After I compile successfully three
I'm trying to compile a project that uses the GData objective-c framework. I've successfully
I am attempting to compile and run a test C program in Xcode. This

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.