I have to write program in c linux for operating systems class - communicator using fifo which has to work like that: ./Speak create name (to create user) ./Speak send from to (to send msg from user to user) ./Speak history name (to read all msgs sent to user Every msg is only sent when other person can read it and after reading it msg is deleted(because its fifo based). My question is how can i achive that, do I have to run 2 instances of program in 2 different terminals? For example in first one I write ./Speak send …

Member Avatar
Member Avatar
+0 forum 1

So here's my problem I have inner structure inside of client. How can I know while reading from txt file that I'm reading item data or client data for my list? struct item { char item_name[30]; char item_state[30]; float item_price; char item_status[30]; float item_price_if_not; struct item *next; }; struct client { char client_name[30]; char client_last_name[30]; struct item *item_data; struct client *next; }; void savetxt(struct client *head) { FILE *f; f = fopen("data.txt","w"); if(f == NULL) { printf("error"); } struct item *CurrentItem = head->item_data; while(head != NULL) { fprintf(f,"%s %s\n",head->client_name,head->client_last_name); while(CurrentItem != NULL) { fprintf(f,"%s %s %f %s %f ",CurrentItem->item_name,CurrentItem->item_state,CurrentItem->item_price,CurrentItem->item_status,CurrentItem->item_price_if_not); CurrentItem …

Member Avatar
Member Avatar
+0 forum 18

I'm trying to make make project for my programming class. All that's left is deleting elements and editing elements. Basicaly my question is how would I do it for my inner list? Or how would I delete single client from list? Would I first have to free the client's inner list if so how should I proceed to do so? #include <stdlib.h> #include <time.h> #include <string.h> #include <stdio.h> struct date { int day; int month; int year; struct date* next; }; struct item { char item_name[30]; /* char item_state[30]; double item_price; char item_status[30]; double item_price_if_not; struct date *issue_date;*/ struct item …

Member Avatar
Member Avatar
+0 forum 10

Im writing project for my programming lessons and right now got some problems with output from function AddItemToClient, basicaly its mainly with date, in first node its correct one but after this its just random. Could someone explain what I'm doing wrong here? #include <stdlib.h> #include <time.h> #include <string.h> #include <stdio.h> struct date { int day; int month; int year; struct date* next; }; struct item { char item_name[30]; char item_state[30]; double item_price; char item_status[30]; double item_price_if_not; struct date *issue_date; struct item *next; }; struct client { char client_name[30]; char client_last_name[30]; struct item *item_data; struct client *next; }; //ADD CLIENT// …

Member Avatar
Member Avatar
+0 forum 2

I have following problem: I have 2 structures: Clients and items for example structure clients would have name and list of items from another structure asigned to this specific name I have to do this with singly linked lists. I simply have no idea how to do this would be great if somebody could explain to me how to do this and give example of how this should look aswell.

Member Avatar
Member Avatar
+0 forum 16

The End.