mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-07 21:04:00 +02:00
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;
|
||||
} items[100];
|
||||
|
||||
int items_count;
|
||||
|
||||
void fill_items()
|
||||
{
|
||||
char buf[128];
|
||||
|
@ -16,8 +18,33 @@ void fill_items()
|
|||
fclose(f);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
fill_items();
|
||||
int read_item() {
|
||||
char buf[128];
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue