I have a struct defined as
struct my_struct {
struct hdr_str hdr;
char *content;
};
I am trying to pass the content in my_struct of the first element in my_struct by nesting it all as a parameter to read()
what I have is
struct my_struct[5];
read is defined as
ssize_t read(int fd, void *buf, size_t count);
and I am trying to pass it as
read(fd, my_struct[0].content, count)
But I am receiving -1 as a return value, with errno = EFAULT (bad address)
Any idea how to make read read into a char * in a struct array?