[go: nahoru, domu]

Skip to content
/ pyc4 Public
forked from rswier/c4

A Python extension to run C code in Python.

License

Notifications You must be signed in to change notification settings

donno2048/pyc4

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyc4

A Python extension to run C code in Python based on c4.

Install

pip install pyc4

Use

The first argument is the code the rest are the argv

>>> import c4
>>>
>>> c4.execute(r"""
... int main() {
...     printf("hi\n");
...     return 0;
... }
... """)
hi
0
>>> c4.execute(r"""
... int main(int argc, char **argv) {
...     printf("%s\n", argv[0]);
...     return 1;
... }
... """, "hi")
hi
1