Skip to content

Instantly share code, notes, and snippets.

@D3f0
Created April 27, 2018 23:48
Show Gist options
  • Save D3f0/4aa22185468a3187147ce99bd7f0c39a to your computer and use it in GitHub Desktop.
Save D3f0/4aa22185468a3187147ce99bd7f0c39a to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting main.c\n"
]
}
],
"source": [
"%%writefile main.c\n",
"#include <stdio.h>\n",
"\n",
"int main(int argc, char **argv) {\n",
" int i = 0;\n",
" \n",
" for (i=0; i<argc; i++) {\n",
" printf(\"En argv[%d]: %s\\n\", i, argv[i]);\n",
" } \n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"!gcc main.c -o main"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Podemos usar el `%%bash` \n",
"#### ...pero la `stdout` se diuja *postmortem*"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"En argv[0]: ./main\n",
"En argv[1]: 192.168.88.27\n"
]
}
],
"source": [
"!./main 192.168.88.27"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment