mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-07 21:04:00 +02:00
Separated I/O operations into itemio.c
Signed-off-by: Cestmir Houska <czestmyr@gmail.com>
This commit is contained in:
parent
842a6eb13f
commit
bf838ea046
4 changed files with 43 additions and 19 deletions
12
Makefile
12
Makefile
|
@ -1,11 +1,19 @@
|
||||||
CC=bcc
|
CC=bcc
|
||||||
CFLAGS=-Md -W
|
CFLAGS=-Md -W
|
||||||
|
LDFLAGS=-Md -W
|
||||||
|
|
||||||
brmbar.com: brmbar.c defines.h
|
brmbar.com: brmbar.o itemio.o
|
||||||
$(CC) $(CFLAGS) brmbar.c -o brmbar.com
|
$(CC) $(LDFLAGS) brmbar.o itemio.o -o brmbar.com
|
||||||
|
|
||||||
|
brmbar.o: brmbar.c defines.h itemio.h
|
||||||
|
$(CC) $(CFLAGS) brmbar.c -c -o brmbar.o
|
||||||
|
|
||||||
|
itemio.o: itemio.c defines.h itemio.h
|
||||||
|
$(CC) $(CFLAGS) itemio.c -c -o itemio.o
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f brmbar.com
|
rm -f brmbar.com
|
||||||
|
rm -f *.o
|
||||||
|
|
||||||
run:
|
run:
|
||||||
dosbox brmbar.com
|
dosbox brmbar.com
|
||||||
|
|
18
brmbar.c
18
brmbar.c
|
@ -1,21 +1,5 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "itemio.h"
|
||||||
struct item {
|
|
||||||
char ean[EAN_MAXLEN];
|
|
||||||
char name[NAME_MAXLEN];
|
|
||||||
int price;
|
|
||||||
} items[ITEM_MAXNUM];
|
|
||||||
|
|
||||||
void fill_items()
|
|
||||||
{
|
|
||||||
char buf[128];
|
|
||||||
FILE *f = fopen("items.txt", "r");
|
|
||||||
while (fgets(buf, 128, f)) {
|
|
||||||
printf("%s\n", buf);
|
|
||||||
}
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
15
itemio.c
Normal file
15
itemio.c
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "itemio.h"
|
||||||
|
|
||||||
|
struct item items[ITEM_MAXNUM];
|
||||||
|
|
||||||
|
void fill_items()
|
||||||
|
{
|
||||||
|
char buf[128];
|
||||||
|
FILE *f = fopen("items.txt", "r");
|
||||||
|
while (fgets(buf, 128, f)) {
|
||||||
|
printf("%s\n", buf);
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
17
itemio.h
Normal file
17
itemio.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef _BRMBAR_ITEMIO_H_
|
||||||
|
#define _BRMBAR_ITEMIO_H_
|
||||||
|
|
||||||
|
#include "defines.h"
|
||||||
|
|
||||||
|
struct item {
|
||||||
|
char ean[EAN_MAXLEN];
|
||||||
|
char name[NAME_MAXLEN];
|
||||||
|
int price;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct item items[ITEM_MAXNUM];
|
||||||
|
|
||||||
|
extern void fill_items();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue