This file is c-input.txt in the class locker. A quick guide to the library functions for C input. Do "man fgets", "man sscanf", etc. for the details, and come to sections for more help if needed. Also, these functions are all written up in books on C because they are so widely used. fgets() Gets one line of input into your char array; you need to tell it the length of your array. If it returns a null pointer, it has hit end-of-file. Use "stdin" for the file-id to read from stdin. DO NOT USE gets() ; it is unsafe in that it might run over your array bounds. sscanf() Extracts multiple fields of specified types from the line you read in with fgets. Addresses of the destinations need to be passed, usually by using the "&" (address-of) operator. This function is handy when the input line has an expected format. strtok() Finds one word at a time in the line you read in with fgets. Each word is a string, and strtok returns a pointer to it. You need to copy it to a permanent location or convert it to a number. Use strncpy() to copy it to your char array, or strdup() to malloc some new space and copy it there, or atoi() to convert to an int, or atof() to convert to a float. strncpy(), strncat() Copy or concatenate a string into your char array; you need to tell it the length of your array that is receiving the data. DO NOT USE strcpy() or strcat(); they are unsafe in that they might run over your array bounds. strcmp() Compare two strings. DO NOT USE the "n" version in this case (unless you have some special reason why you don't want to compare the whole strings). =================================================================== INCOMPLETE EXAMPLE typedef struct WeightedEdge { char* city1; char* city2; float dist; } WeightedEdge; ... WeightedEdge readWeightedEdge(void) { char buf [500]; char* fgetsRetn; WeightedEdge e; fgetsRetn = fgets(buf, 500, stdin); if (fgetsRetn == buf) { e.city1 = strdup( strtok(buf, " \t\n") ); e.city2 = strdup( strtok(NULL, " \t\n") ); e.dist = atof(strtok(NULL, " \t\n") ); } else { /* end-of-file or read-error. do something. */ } return e; } ===================================================================