emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Capturing output from C/C++


From: Nick Dokos
Subject: Re: [O] Capturing output from C/C++
Date: Thu, 05 Mar 2015 13:32:38 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Roger Mason <address@hidden> writes:

> Hello,
>
> I have a short C++ program:
>
> #+BEGIN_SRC cpp :flags -lm :results output
> #include <iostream>
> #include <fstream>
> #include <cmath>              // for ceil
> #include <cstdlib>            // for atof
>
>   double f (double fv, double o, int i) {
>     return fv / 2.0 + (1.0 - o) * fv * i;
>   }
>
> int num (double d, double fv, double o) {
>   return (int)ceil( d / ((1.0 - o) * fv ));
>   }
>
> int main (int argc, char* argv[]) {
>     if ( argc < 6 ) {
>       std::cout << "Usage:\n" << std::endl;
>       std::cout << "grid w fovx ox h fovy oy\n" << std::endl;
>       return 1;
>     }
> ...
> #+END_SRC
>
> that outputs some data to stdout.
>
> So far I have not been able to capture the output of the program back
> into to my org buffer.
>
> Is that possible and, if so, how?
>

You call your program with no arguments, which means that it returns 1,
which is interpreted as an error. Try returning 0 or fix the call so
that it goes through the path that returns 0.

Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]