-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.c
52 lines (35 loc) · 1.02 KB
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include "list.h"
int main() {
char line[STD_LINE_DIM];
char* token[TOKEN_ARR_MAX_DIM];
list head;
element src;
FILE* fp;
fp = openFile("./negozio.txt", "r");
if (fp == NULL) {
exit(-1);
}
head = emptyList();
while (readLine(fp, line, STD_LINE_DIM) >= 0) {
getTokenLine(line, " ", token);
loadElementData(token, "%d%s%c%d%f", &src.ID, &src.content, &src.type, &src.qty, &src.cost);
//head = insertHead(head, src);
//head = insertTail(head, src);
// insertAfter(head, src);
head = insertOrdered(head, src, INCREASING);
}
printList(head);
/* printf("\nThere are %d nodes in your linked list.\n", numberOfNodes(head));
puts("Enter the ID of the item you want to buy.");
int x = scanf("%d", &x);
if (checkNode(head, x) == true) {
puts("The item you're searching for is available.");
}
else {
puts("Sorry, we couldn't find that item.");
} */
return closeFile(fp);
}