Пример #1
0
int core_fread(core_file* fc, void* buff, size_t len)
{
    CORE_FILE* f = (CORE_FILE*)fc;

    if (f->f) {
        fread(buff,1,len,f->f);
    } else {
        HTTP_GET(f->host, f->port, f->path, f->seek_ptr, len, buff);
    }

    f->seek_ptr += len;

    return len;
}
Пример #2
0
size_t core_fsize(core_file* fc)
{
    CORE_FILE* f = (CORE_FILE*)fc;

    if (f->f) {
        size_t p=ftell(f->f);
        fseek(f->f,0,SEEK_END);
        size_t rv=ftell(f->f);
        fseek(f->f,p,SEEK_SET);
        return rv;
    }
    else {
        return HTTP_GET(f->host, f->port, f->path, 0, 0,0);
    }
}
Пример #3
0
int main(void){
	const char* hostname="localhost";
	const int   port=8000;
	const int   id=1;
	const char* password="******";
	const char* name="Team+Awesome";
	const int   adcval=123;
	const char* status="Very+good+thank+you";

	char buf[1024];
	snprintf(buf, 1024, "http://%s:%d/update?id=%d&password=%s&name=%s&data=%d&status=%s",
			hostname,
			port,
			id,
			password,
			name,
			adcval,
			status);
	HTTP_GET(buf);
	return 0;
}