Hi all,
I have a problem with my code.

I use in a struct variable type time_t with name tt
like

typedef struct{
  time_t tt;
}

then I initialise in the main function of my server

time_t timer;
timer=time(NULL);

I pass the timer in my shared memory

shared_parking[parking_id]->tt=timer;

I send the stucture and then I try to print time in my client

printf("\t\tLast Reservation Time: %s\n",asctime(localtime(&parking_msg.data_index.data.tt)));

But I take a segmentation fault.
Also when I compile client I take a warning
client.c:571:4: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’


What is wrong ?

Recommended Answers

All 3 Replies

Please post more code. Ideally it would be a complete (SHORT!) program that we can cut, paste, and compile as-is and see the error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.