I am working on a Priority Based Scheduler which reads the process in from a file. I have it reading from file and printing to the screen. I'm trying to use strtok to tokenize a line from the process test file and store it in three different arrays. The layout of the process file is:
Process Quanta Priority
Process0 12 1
Process1 10 9
Process2 15 4
And so on for about 800 lines.
I want it to token the spaces between the process and it's quanta and priority and store it in corresponding arrays.
So basicly:
Process0 will be stored in array Process, Quanta in Quanta, Priority in Priority
When it reads in the next line it repeats the storing steps by incrementing the i.
This is what I have so far.
char delims[] = " ","\n";
char *result = NULL;
result = strtok( line, delims );
while( result != NULL )
{
if(result = " ")
{
}
fprintf( file1, "%s\n", result );
printf("Process Printed to file\n");
result = strtok( NULL, delims );
}
(The Process Printed to File is for my own references to make sure strtok was working)
Any help would be much appreciated.