Ask Your Question

Calling a C function with printf from sage

asked 2016-02-22 15:25:01 +0200

kroovy gravatar image


I'm trying to run the first example in on SageMathCloud. After creating the necessary hello.c and hello_sage.pyx, I tried running the Cython function in a sage notebook:

%runfile hello_sage.pyx

The problem is that I see the pyx was compiled successfully, but nothing is printed.

I would appreciate any help on how to run the example, or an alternative way to print from a C function that would be visible in the notebook. (I have a more complex C file that I'm trying to run, but it is difficult to debug it without printing)


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-02-24 13:06:44 +0200

Harald Schilly gravatar image

The issue is, that C prints somewhere, where the sagews isn't picking it up. Maybe rewriting print such that it appends to stdout helps?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-02-22 15:25:01 +0200

Seen: 636 times

Last updated: Feb 24 '16