Skip to main content

Thread: C: capturing stdout


i want write testcase testing output of function printing stderr.
somehow need stderr within same process.
want avoid having execute testcase wrapperscript.

found can reopen stderr filestream freopen seems impossible reattach output stderr again in portable way.
unfortunately too.

there way i'm overlooking capture stderr , resetting in c, without changing outputting functions code or using wrapper program around testcase?

pseudo code i'm looking for:
code:
to_test():    print "output"    test_function():    file = freopen("file", stderr)    to_test();    assert(compare_with_golden_file(file, golden))    reset_stderr

wait? in c? why using python in example?

edit: oh... pseudocode, sorry that.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk C: capturing stdout


Ubuntu

Comments

Popular posts from this blog

Help with codes to add 1 more shift register and add more to matrix LED

tcp client

Can't read sms using Thinker A7 communicate with Arduino