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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:30:25+00:00 2026-05-20T18:30:25+00:00

I am writing a parser which operates on C/C++ source files. As 1st stage

  • 0

I am writing a parser which operates on C/C++ source files. As 1st stage of parser I need to use some already available preprocessor, so that I can get away with directives such as #define, #ifdef.
For g++, the available tool is 'cpp' (or g++ -E ...). I had 2 questions:

  1. My parser is written in C++, so what could be the best way to run this ‘cpp’ on other C/C++ source files? Is it something like:

    system("cpp sourceFile.cpp parsed_sourceFile.cpp"); // just a pseudo code
    

    Or is there any better way?

    (I want to know only the possible ways by which I can perform a preprocessing on given files. Are these commands like system(), or popen() are standard way to do such thing?)

  2. How can I take care of the non-standard included files inside the source files? I will not know of anything that at which place these user defined header files are stored.

  • 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-20T18:30:25+00:00Added an answer on May 20, 2026 at 6:30 pm

    system is the most cross-platform way possible. But if your code is single-platform, you can have better control over the execution of subprograms by using platform’s native API. Like ShellExecute in windows.

    There are a variety of places non-standard include files can be located, such as in the same directory as the source script. Such directories are usually mentioned in the project and MAK file of the projects. You can open those files and look for extra include locations mentioned in them. But the easier 😉 way is of course to ask the user himself where those include files are.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a parser for some LISP files. I'm trying to get rid of
I am writing a parser which calls some functions dependent on some value. I
I'm writing a construct in PHP where a parser determins which function to call
I'm writing a parser for an internal xml-based metadata format in python. I need
I am writing a parser for csv-files, and sometimes I get NumberFormatException. Is there
I'm writing a parser in PHP which must be able to handle large in-memory
I'm writing a abstract file parser (C#) which is extended by two concrete parsers.
I am writing a parser to parse incoming text files. I have it to
I am in the process of writing a parser in which two lines are
I am writing an SMTP parser that needs to handle standard smtp as well

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.