/* * Win (Thanawin Pattanaphol) * vendorInfo.c * 8th August 2024 */ #include #include #define MAX_VENDORS 20 #define MAX_FILENAME_LENGTH 4096 int read_input(char str[], int n); struct vendor_item { char vendor_name[20]; char merchandise[15]; int inventory_count; int item_price_baht; } vendors[MAX_VENDORS]; int main() { char file_name[MAX_FILENAME_LENGTH]; read_input(file_name, MAX_FILENAME_LENGTH); FILE *fp; if ((fp = fopen(file_name, "r")) == NULL) { printf("%s cannot be opened.\n", file_name); exit(EXIT_FAILURE); } fclose(fp); return 0; }; int read_input(char str[], int n) { int ch, i = 0; while ((ch = getchar()) != '\n') { if (i < n) { str[i++] = ch; } } str[i] = '\0'; return i; }