#!/bin/ch
/* Copyright (c) 2001 by SoftIntegration, Inc. All Rights Reserved */
#include <cgi.h>

int main() {
    class CResponse Response;
    class CRequest Request;
    int total;
    size_t countToRead;

    Response.begin();
    Response.title("Test of Request.binaryRead and Request.getTotalBytes");
    printf("<H1> Test of Request.binaryRead and Request.getTotalBytes</H1><hr>\n");

    total = Request.getTotalBytes();
    printf("The result of Request.getTotalBytes is : %d <p>\n", total);

//    countToRead = total; 
//    printf("The raw data is : %s <p>\n", Request.binaryRead(&countToRead));

    countToRead = 4; 
    printf("To read %d bytes data.<br>\n", countToRead);
    printf("The raw data is : %s <br>\n",  Request.binaryRead(&countToRead));
    printf("The actually read bytes is : %d <p>\n", countToRead);

    countToRead = 5; 
    printf("To read %d bytes data. <br>\n", countToRead);
    printf("The raw data is : %s <br>\n", Request.binaryRead(&countToRead));
    printf("The actually read bytes is : %d <p>\n", countToRead);

    countToRead = 50; 
    printf("To read %d bytes data. <br>\n", countToRead);
    printf("The raw data is : %s <br>\n", Request.binaryRead(&countToRead));
    printf("The actually read bytes is : %d <p>\n", countToRead);

    Response.end();
}