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

  • Home
  • SEARCH
  • 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 509915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:03:36+00:00 2026-05-13T07:03:36+00:00

I am generating C code based on information provided by another file (an XML

  • 0

I am generating C code based on information provided by another file (an XML file). Certain chunks of C are included in this XML file and should be included verbatim in my generated C file. I wish to use the #line directive, so that if these chunks contain an error, the user will see the line number in the XML file that the chunk came from. For example, I wish to generate code like:

int main() {
   #line 35 "file.xml"
   ....
   #line
}

I wish to somehow “close” the #line section, I mean I think if there is an error e.g. with the closing } and that is generated by my program, the user should not see “error on line 36 of file.xml”, that will be meaningless to them and confuse them.

For example, I could imagine a #line directive on its own (as in my example) would do something like that. But it doesn’t work, and there is no such mention of any such facility in the gcc docs on #line.

Is there any such facility I’m missing? Or am I just asking for something that doesn’t exist? How would you go about such a problem?

  • 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-13T07:03:37+00:00Added an answer on May 13, 2026 at 7:03 am

    You need to issue another #line directive “resetting” to the line and filename of your original file.

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

Sidebar

Related Questions

Quasi-quotes allow generating AST code during compilations, but it inserts generated code at the
I'm generating auto incremental code through a PHP script. The sequence goes like this,
I have written java code for generating json of my searched data from file.But
This is based on generating a second x-axis, as described in this previous post:
I'm looking at writing a tool for generating code based on the contents of
I'm generating java code based on various WSDL's. We have a different WSDL for
So I inherited this code, or should I say, someone developed this and moved
I'm moving from xml mapping to a code based mapping. There is a problem
Im generating an Excel 2010 report based on a template in code using Microsoft.Office.Interop.Excel;
I am simply generating a csv file based on data stored in a mysql

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.