can anyone help?
thanks
Code:
/* Reading from the script file */
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <ctype.h>
//#include <iostream>
#include <string.h>
int main()
{
FILE *myFile;
char filename[20];
/* Ask user to enter the filname including the format */
printf( "Enter the script filename with the format. ie script.txt\n" );
scanf( "%s", filename );
/* Open filename for Reading (only) */
myFile = fopen(filename, "r");
if (myFile == NULL) {
printf("ERROR! Unable to open your file.\n");
printf( "Closing file.......\n" );
//delay two second
sleep (2000);
exit(-1);
}
/* Open file success message */
else {
printf( "The file %s is valid\n\n", filename );
}
char string[500];
fgets (string , 500 , myFile);
int strcmp( const char *str1, const char *str2 );
char *tokenPtr;
tokenPtr = strtok( string , " " );
while ( tokenPtr != NULL ) {
printf( "%s\n", tokenPtr );
tokenPtr = strtok( NULL, " " );
}
//EXE Crashes here
if ( strcmp ( tokenPtr, "RESET" ) == 0 ){
printf ("\n Resetting the motors.");
//outportb(0x378, 0);
}
getch();
return 0;
}