Problem with scatter/gather IO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I will read/write file with readv() and writev(), I have problem to
use that since the struct iovec will be a variable-length array, if i
have code.

struct foo {
    unsigned char data[100];
    unsigned char another_data[28];
};
unsigned len;
....

/* calculate len */
/* use len as array's member size */
struct iovec iov[len];
printf("len is: %i\n", len);
readv(fd, iov, len);

I got: BAD ADDRESS, and if I remove the printf() then I will get
INVALID ARGUMENT. What the possible problem with that?

Thanks,
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux