![]() |
| ||
| Adding to linked list from external file Hi, I am writing a program at the moment which requires me to scan in data from an external file, which to be added to a linked list. The external file is a list of pairs of cities and the distances between them - each piece of data is tab-delimited, and each pair of cities is on a new line. Each node within the linked list should contain the name of city one, the name of city two, and the distance between them. My code so far is shown below: typedef struct node_pair_info // declare structure for npi databaseThe way which i intend for it to work at the moment is that upon the user entering 'a', all the data will be added to the linked list. The program compiles, but upon running, crashes. Im not certain that the code is correct! If anybody could lend me a hand i would be most grateful! Thanks, Charlie |
| ||
| Re: Adding to linked list from external file One thing I see right away: fscanf(cities, "%s \t %s \t %d\n", new_node->city1, |
| All times are GMT -4. The time now is 9:18 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC