Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
The PRE_HEAD config option is a recent addition (beginning in 0.51) - it's documented in 'perldoc Inline::C'.

Thank you. That looks perfect for this and a couple of other things I've wanted in the past.

With regard to using PerlIO*. I often use I::C to prototype ideas that ultimately might end up being used or reused in stand alone C programs.

I::C is so useful because it allows me to try things out without having to build a working C front end first, (file handling, argument handling, error handling etc.), which Perl gives me, and does so much better anyway. Hence I often try to avoid using any XS/perlish stuff within the routines themselves.

In this case, the output I'm writing goes to a file that exists (is opened/written/closed) entirely within the C code, but it runs a long time and is quite hard to get right. Rather than having to wait until the code completes and then inspect the file, I wanted to direct the output to stderr so that I could send it to the file by way of tee, so that I could keep an eye on things and abort early if I could see they were going wrong.

That should have been as easy as just substituting stderr for the FILE* I've opened in the output calls, but then I re-encountered the old problem.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^4: Using stderr from Inline::C: (part deux) by BrowserUk
in thread Using stderr from Inline::C: (part deux) by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 00:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found