1 msgWide Streams
4 msgMINGW I/O support for file sizes > 2GB (LFS ...
2 msg#define WINVER 0x0400
11 msgWhy does g++ not link with libstdc++?
3 msghow to compile and link a library
1 msgHey Guys
5 msgCompile error using mingw
2 msg'include/c++/ext' missing fromgcc-part-c++-4.3....
1 msgFMTID_SummaryInformation andFMTID_UserDefinedPr...
2 msghow to realize mouse programming
3 msglooking for tiny light cross platform filesyste...
2 msgMinGW GCC Development Plan

how to use the read/write
\ yu jie (5 May 2008)
. \ Tor Lillqvist (5 May 2008)
. . \ yu jie (5 May 2008)

74 msgGCC 4.3.0 20080502 (alpha) Released - Please he...
10 msgMinGW gcc 3.x, 4.x and exceptions
4 msgdllwrap 2.17.50 20060824
12 msgstrtod is not C99-compatible
4 msgTest program crashes with g++ 4.2.1-dw2 usingli...
25 msgimlib2
5 msgDisassembly of stack frame
Subject:how to use the read/write
Group:Mingw-users
From:yu jie
Date:5 May 2008


 


Hi, all:
The size of a.pdf is about 24M. I get weird result from the following code,
the read function in while condition only returns twice.

#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main()
{
int fd, i = 0;
ssize_t ret;
char buffer[4*1024];
fd = open("d:/a.pdf", O_RDONLY);
if (fd < 0) {
printf("can't open\n");
return 0;
}
while ((ret = read(fd, buffer, 4*1024)) > 0) {
printf("%d, %d\n", ret, ++i);
}
close(fd);
return 0;
}


Best wishes.



Kevin


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

_______________________________________________
MinGW-users mailing list
MinGW-users

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users



© 2004-2008 readlist.com