Subversion Repositories HelenOS

Rev

Rev 2971 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2971 Rev 2977
Line 57... Line 57...
57
    if (fd < 0) { printf("open failed\n"); return -1; }
57
    if (fd < 0) { printf("open failed\n"); return -1; }
58
 
58
 
59
    printf("write %d bytes...\n", length);
59
    printf("write %d bytes...\n", length);
60
    nbytes = length; dp = data; written = 0;
60
    nbytes = length; dp = data; written = 0;
61
    while (nbytes > 0) {
61
    while (nbytes > 0) {
62
        cnt = write(fd, dp, min(4096, nbytes));
62
        cnt = write(fd, dp, min(16384, nbytes));
63
        if (cnt < 0) { printf("write failed\n"); return -1; }
63
        if (cnt < 0) { printf("write failed\n"); return -1; }
64
        dp += cnt;
64
        dp += cnt;
65
        written += cnt;
65
        written += cnt;
66
        nbytes -= cnt;
66
        nbytes -= cnt;
67
        printf("written: %d, cnt: %d, left: %d\n", written, cnt, nbytes);
67
        printf("written: %d, cnt: %d, left: %d\n", written, cnt, nbytes);
68
    }
68
    }
69
 
69
 
70
    printf("\n\nwritten %d bytes\n", written);
70
    printf("\nwritten %d bytes\n", written);
71
    close(fd);
71
    close(fd);
72
 
72
 
73
    return 0;
73
    return 0;
74
}
74
}
75
 
75