summaryrefslogtreecommitdiff
path: root/Programming_in_C/Chapter_16.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Programming_in_C/Chapter_16.ipynb')
-rwxr-xr-xProgramming_in_C/Chapter_16.ipynb26
1 files changed, 16 insertions, 10 deletions
diff --git a/Programming_in_C/Chapter_16.ipynb b/Programming_in_C/Chapter_16.ipynb
index 2b519af8..535875b5 100755
--- a/Programming_in_C/Chapter_16.ipynb
+++ b/Programming_in_C/Chapter_16.ipynb
@@ -1,6 +1,6 @@
{
"metadata": {
- "name": "Chapter 16"
+ "name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -211,7 +211,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\n",
+ "import sys\n",
"def main():\n",
"\n",
" #Variable Declaration/ User Input\n",
@@ -252,14 +252,12 @@
"metadata": {},
"outputs": [
{
- "ename": "NameError",
- "evalue": "global name 'source' is not defined",
+ "ename": "SystemExit",
+ "evalue": "",
"output_type": "pyerr",
"traceback": [
- "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
- "\u001b[1;32m/home/jovina/TBC/nalin/Stephen G Kochan--Programming in C/<ipython-input-3-388aacca0b5d>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 40\u001b[0m \u001b[1;31m#Setting top level conditional script\u001b[0m\n\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 41\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0m__name__\u001b[0m\u001b[1;33m==\u001b[0m\u001b[1;34m'__main__'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 42\u001b[1;33m \u001b[0mmain\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 43\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
- "\u001b[1;32m/home/jovina/TBC/nalin/Stephen G Kochan--Programming in C/<ipython-input-3-388aacca0b5d>\u001b[0m in \u001b[0;36mmain\u001b[1;34m()\u001b[0m\n\u001b[0;32m 19\u001b[0m \u001b[0minn\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msource\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtxt\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m\"r\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 20\u001b[0m \u001b[1;32mexcept\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;31m# Exception:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 21\u001b[1;33m \u001b[1;32mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"cant open {0} for reading\"\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msource\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtxt\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 22\u001b[0m \u001b[0msys\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mexit\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 23\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
- "\u001b[1;31mNameError\u001b[0m: global name 'source' is not defined"
+ "An exception has occurred, use %tb to see the full traceback.\n",
+ "\u001b[0;31mSystemExit\u001b[0m\n"
]
},
{
@@ -267,11 +265,19 @@
"stream": "stdout",
"text": [
"Enter name of the file to be copied: \n",
- "Enter name of the output file: \n"
+ "Enter name of the output file: \n",
+ "cant open source.txt for reading\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stderr",
+ "text": [
+ "To exit: use 'exit', 'quit', or Ctrl-D.\n"
]
}
],
- "prompt_number": 3
+ "prompt_number": 2
},
{
"cell_type": "code",