1 Replies - 4403 Views - Last Post: 16 October 2012 - 11:18 AM Rate Topic: -----

#1 Fushigisou   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 10-November 11

Using ctopy

Posted 16 October 2012 - 10:47 AM

I heard about ctopy where it can kind of translate c code into python code so I wanted to give it a try but I don't know how to go about using the files that were in the zip. My best guess is that its a file to put into a C compiler like eclispe for C but yeah I'm lost

If anyone could tell how to get it working that be awesome

Is This A Good Question/Topic? 0
  • +

Replies To: Using ctopy

#2 sepp2k   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2754
  • View blog
  • Posts: 4,414
  • Joined: 21-June 11

Re: Using ctopy

Posted 16 October 2012 - 11:18 AM

ctopy is a Python script, so it doesn't need to be compiled (and certainly not by a C compiler - also: Eclipse is an IDE, not a compiler). You simply run it using the Python interpreter.

It will read the C source that you want to translate via the standard input and will write the translated Python code on the standard output. I expect the most common way to use it would be using shell redirection like this:

python ctopy < my-c-code.c > my-python-code.py

Or, alternatively if you're using a unixoid operating system:

./ctopy < my-c-code.c > my-python-code.py

Either way you need to be in the same directory as the script to invoke it this was. On an unixoid system you can also copy it to a location in your $PATH and then invoke it like this from anywhere:

ctopy < my-c-code.c > my-python-code.py

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1