I would to ask you, how initiate array in struct for size from keyboard(argv) with shared memory, I can't use malloc, because it initiate's privat or something like that.
For example piece of code
Struct with array which I want initiate
struct data
{
char txt[size from keyboard];
};
How to resize this array, remembering that we will use shared memory IPCV?
Thanks form your help :)
edit:
so if I had one more variable in struct, Can I do it like this?
struct data
{
int counter;
char *text;
}*shared data;
int shmid
int main(int argc, char* argv[])
{
int m = atoi(argv[1]) /* number of slots*/
int n = atoi(argv[2]) /*size of txt */
shmid = shmget(12345, m * n * sizeof(struct my_data), IPC_CREAT|)600|IPc_EXCL));
shared_data = (struct data*)shmat(shmid, NULL, 0);
/*So now Can I write to txt??? */
}