iBuy data structures
Functions to read and write iBuy data from files
|
iBuy file read/write functions prototypes More...
#include "structures.h"
Go to the source code of this file.
Functions | |
int | readUsersFromFile (char inputFile[], struct User users[], int *nUsers) |
Read data from a file to initialize User structures. More... | |
int | writeUsersToFile (char outputFile[], struct User users[], int nUsers) |
int | readItemsFromFile (char inputFile[], struct Item items[], int *nItems) |
int | writeItemsToFile (char outputFile[], struct Item items[], int nItems) |
iBuy file read/write functions prototypes
int readItemsFromFile | ( | char | inputFile[], |
struct Item | items[], | ||
int * | nItems | ||
) |
Read data from a file to initialize Item structures
[in] | inputFile | File name string |
[out] | items | Array of Item structures |
[out] | nItems | Number of read items |
The function reads a text file line-by-line. The function reads MAX_ITEMS elements at most. Lines have the format: Description;Name;Price;ID_seller;ID_user_voted_Like_1, ..., ID_user_voted_Like_N;ID_user_voted_Deal_1,...,ID_user_voted_Deal_M;ID_user_voted_Sold_1,...,ID_user_voted_Sold_P;
Example: A new brand real flux capacitor;Item1;182.64;2;1,2;3,4;5,6;
int readUsersFromFile | ( | char | inputFile[], |
struct User | users[], | ||
int * | nUsers | ||
) |
Read data from a file to initialize User structures.
[in] | inputFile | File name string |
[out] | users | Array of User structures |
[out] | nUsers | Number of read users |
The function reads a text file line-by-line. The administrator user data IS NOT expected to be in the file. The function reads MAX_USERS elements at most. Lines have the format: Login;Password;Name;Surname;Favorite_User_1_UUID,Favorite_User_2_UUID,...;
Example: Lolmar;qwertyui;Lolencio;Martinez;1,4;
int writeItemsToFile | ( | char | outputFile[], |
struct Item | items[], | ||
int | nItems | ||
) |
Write data from Item structures to a file
[in] | outputFile | File name string |
[in] | items | Array of Item structures |
[in] | nItems | Number of elements in array items |
The function writes item data into a text file line-by-line. Lines have the format: Description;Name;Price;ID_seller;ID_user_voted_Like_1, ..., ID_user_voted_Like_N;ID_user_voted_Deal_1,...,ID_user_voted_Deal_M;ID_user_voted_Sold_1,...,ID_user_voted_Sold_P;
Example: A new brand real flux capacitor;Item1;182.64;2;1,2;3,4;5,6;
int writeUsersToFile | ( | char | outputFile[], |
struct User | users[], | ||
int | nUsers | ||
) |
Write data from User structures to a file
[in] | outputFile | File name string |
[in] | users | Array of User structures |
[in] | nUsers | Number of elements in array users |
The function writes users into a text file line-by-line. The administrator user IS NOT printed into the file. Lines have the format: Login;Password;Name;Surname;Favorite_User_1_UUID,Favorite_User_2_UUID,...;
Example: Lolmar;qwertyui;Lolencio;Martinez;1,4;