Commit edf1c4ca authored by Lucas Mello Schnorr's avatar Lucas Mello Schnorr
Browse files

test if files aren't available, to avoid a segfault

parent 54b6968f
......@@ -16,7 +16,10 @@
//
// REMEMBER: Vx is for velocity; vx is for vertex.
//
//
#define ESD_SUMARIO "esd-summary.dat"
#define ESD_DETALHE "esd-detail.dat"
void main() {
......@@ -26,8 +29,18 @@ void main() {
FILE *detail, *summary;
summary = fopen("esd-summary.dat","r"); // filename must be "esd-summary.dat"
detail = fopen("esd-detail.dat","r"); // filename must be "esd-detail.dat"
// filename must be "esd-summary.dat"
summary = fopen(ESD_SUMARIO,"r");
if (summary == NULL){
fprintf(stderr, "O arquivo %s não pode ser aberto.\n", ESD_SUMARIO);
exit(1);
}
// filename must be "esd-detail.dat"
detail = fopen(ESD_DETALHE,"r");
if (detail == NULL){
fprintf(stderr, "O arquivo %s não pode ser aberto.\n", ESD_DETALHE);
exit(1);
}
i=0;
j=0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment