From 5a564056f59d3ee9b0ff20c45fbe5234a47d5149 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 29 Mar 2000 17:56:02 +0000 Subject: added error checking on file open --- progs/demos/geartrain.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'progs/demos') diff --git a/progs/demos/geartrain.c b/progs/demos/geartrain.c index 91c3411d7c9..7c42aeb3d52 100644 --- a/progs/demos/geartrain.c +++ b/progs/demos/geartrain.c @@ -1,4 +1,4 @@ -/* $Id: geartrain.c,v 1.2 2000/03/22 23:14:54 brianp Exp $ */ +/* $Id: geartrain.c,v 1.3 2000/03/29 17:56:02 brianp Exp $ */ /* * Geartrain simulation @@ -145,6 +145,11 @@ getdata (char filename[]) int gear_count = 0, axle_count = 0, belt_count = 0, i; mainfile = fopen (filename, "r"); + if (!mainfile) { + printf("Error: couldn't open %s\n", filename); + exit(-1); + } + do { Clear_Buffers (); -- cgit v1.2.3