From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Capturing output from C/C++ Date: Thu, 05 Mar 2015 13:32:38 -0500 Message-ID: <87ioefb8hl.fsf@alphaville.usersys.redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTaaA-0005mg-CM for emacs-orgmode@gnu.org; Thu, 05 Mar 2015 13:33:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTaa2-0002zd-BV for emacs-orgmode@gnu.org; Thu, 05 Mar 2015 13:33:14 -0500 Received: from plane.gmane.org ([80.91.229.3]:50790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTaa2-0002zL-5c for emacs-orgmode@gnu.org; Thu, 05 Mar 2015 13:33:06 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YTaa0-0006C4-Dr for emacs-orgmode@gnu.org; Thu, 05 Mar 2015 19:33:04 +0100 Received: from pool-173-76-32-186.bstnma.fios.verizon.net ([173.76.32.186]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 05 Mar 2015 19:33:04 +0100 Received: from ndokos by pool-173-76-32-186.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 05 Mar 2015 19:33:04 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Roger Mason writes: > Hello, > > I have a short C++ program: > > #+BEGIN_SRC cpp :flags -lm :results output > #include > #include > #include // for ceil > #include // 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