47 lines
1.1 KiB
Plaintext
47 lines
1.1 KiB
Plaintext
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <stdint.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
int main(int argc, char const *argv[])
|
||
|
{
|
||
|
printf("Hello, World!\n");
|
||
|
FILE* mazeFile; /* Maze Input File */
|
||
|
char c; /* Holds character for line input from file */
|
||
|
int row; /* Holds number of rows for input from file */
|
||
|
int col; /* Holds number of cols for input from file */
|
||
|
char shold[2000]; /* Holds lines for input from file */
|
||
|
if (argc != 2)
|
||
|
{
|
||
|
printf("An error has ocurred no input file was given.\n");
|
||
|
return 1;
|
||
|
}
|
||
|
mazeFile = fopen(argv[1], "r");
|
||
|
if (mazeFile == NULL)
|
||
|
{
|
||
|
printf("Error in opening the file.\n");
|
||
|
return 1;
|
||
|
}
|
||
|
fgets(shold, 2, mazeFile);
|
||
|
while ( !feof(mazeFile) )
|
||
|
{
|
||
|
switch(shold[0])
|
||
|
{
|
||
|
case 'M':
|
||
|
printf ("Maze encountered\n");
|
||
|
break;
|
||
|
default:
|
||
|
printf ("Basic error\n");
|
||
|
break;
|
||
|
};
|
||
|
fgets(shold, 2, mazeFile);
|
||
|
if (feof(mazeFile))
|
||
|
{
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
fclose(mazeFile);
|
||
|
printf ("So this line won't print without an argument.\n");
|
||
|
return 0;
|
||
|
}
|