forked from brmlab/brmbar-github
reading items wip
This commit is contained in:
parent
0c25b1467c
commit
3fac0f79d2
1 changed files with 30 additions and 3 deletions
33
brmbar.c
33
brmbar.c
|
@ -6,6 +6,8 @@ struct item {
|
||||||
int price;
|
int price;
|
||||||
} items[100];
|
} items[100];
|
||||||
|
|
||||||
|
int items_count;
|
||||||
|
|
||||||
void fill_items()
|
void fill_items()
|
||||||
{
|
{
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
@ -16,8 +18,33 @@ void fill_items()
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int read_item() {
|
||||||
{
|
char buf[128];
|
||||||
fill_items();
|
int i;
|
||||||
|
for (;;) {
|
||||||
|
printf("i> ");
|
||||||
|
if (fgets(buf, 128, stdin)) {
|
||||||
|
for (i = 0; ; ++i) {
|
||||||
|
if (!strncmp( buf, items[0].ean, strlen(items[0].ean) )) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("Unknown item %s\n", buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int read_action() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int i, a;
|
||||||
|
fill_items();
|
||||||
|
for (;;) {
|
||||||
|
i = read_item();
|
||||||
|
a = read_action();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue