-
Notifications
You must be signed in to change notification settings - Fork 0
/
Order.h
49 lines (34 loc) · 1.06 KB
/
Order.h
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
#ifndef ORDER_H_
#define ORDER_H_
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <ctype.h>
#include <time.h>
//create defines
#define CSV "_csv"
#define TXT ".txt"
#define STOP "STOP"
#define NIS "NIS"
#define PATH "/home/braude/Black_Friday/"
#define GETFLYER "/home/braude/GetFlyer"
#define ORDER "_Order"
#define FLYER "GetFlyer" //this is the name if the executable
#define BUFF 128
#define ERROR(...) Error(__VA_ARGS__)
void Error(char* msg, char* mem1, char* mem2, char* mem3, char* mem4, char* mem5, char* mem6);
char* get_csv_item(char* line);
float get_csv_price(char* line, float discount);
float getDiscount(char *line);
char *ltrim(char *str);
char *rtrim(char *str);
char *trim(char *str);
char* read_file(char* path);
/*converts string to num used in discount and in quantity atoi is not used because text is not const*/
float convertStrToNum(char* text);
char* getQty(char *order, int delimeter);
char* getItem(char* order, int delimeter);
int write_to_file(int fd, char* str, int length);
#endif