Quote:
Originally Posted by ramkrix
Thanks fmurphy for your reply.
if I have a structure defined at the beginning in another prgm instaed of an char array name[20],can I use like this?
struct bio {
char name[20];
int age;
float salary;
}
main()
{
struct bio mydata;
--------
--------
--------
read(fd, &mydata, (size_t) ))
}
How can we use the size_t with structure?
Thanks in Advance..
Ramkrix
|
fpmurphy's post clearly says that size_t is a typedef for an unsigned long. Declare a variable of that type as a structure member before using it in the read() call. The (size_t) is the C lang notation for a typecast used when converting from one type to another. Wrap code tags around your program listings.
Code:
struct bio
{
char name[20];
int age;
float salary;
size_t num_of_bytes_read;
}
main()
{
read(fd, &mydata, num_of_bytes_read)
}