ocssw
V2022
|
#include <stdint.h>
Go to the source code of this file.
Classes | |
struct | product_table_str |
Functions | |
product_table_t * | get_product_table (char *file_name, int32_t *num_entries) |
void | free_product_table (product_table_t *table, int32_t num_entries) |
int32_t | search_product_table (product_table_t *table, int32_t num_entries, char *name) |
Detailed Description
functions used to deal with the product table file.
Definition in file get_product_table.h.
Function Documentation
◆ free_product_table()
void free_product_table | ( | product_table_t * | table, |
int32_t | num_entries | ||
) |
free the product table memory.
- Parameters
-
table pointer to product table array num_entries number of entries in the product table
Definition at line 88 of file get_product_table.c.
◆ get_product_table()
product_table_t* get_product_table | ( | char * | file_name, |
int32_t * | num_entries | ||
) |
read the product table file. This routine allocates enough memory to hold the product table and returns a pointer to an array of product_table_t structures to the caller. It is the callers responsibility to free the memory. If there was an error reading the file NULL is returned and *num_entries is set to 0.
- Parameters
-
file_name full file name of the product table file num_entries retuns the numbers of entries read from the file
- Returns
- pointer to product table array, NULL if error
Definition at line 11 of file get_product_table.c.
◆ search_product_table()
int32_t search_product_table | ( | product_table_t * | table, |
int32_t | num_entries, | ||
char * | name | ||
) |
find the product table entry for name.
- Parameters
-
table pointer to product table array num_entries number of entries in the product table name product entry to search for
- Returns
- index for the entry, or -1 if not found
Definition at line 104 of file get_product_table.c.