C (31/207)

From:Yves Grabowsky
Date:04 Dec 99 at 11:17:32
Subject:cps counter

From: YvesGrabowsky@t-online.de (Yves Grabowsky)

Hi,
I'm trying to calculate the cps of a transfer with the following code:

--------CUT HERE-----------
long n, temp, cps;
time_t start, current;

start = time(&start);

do
{
n = Sock_Recv(dtc, buf, LEN_RECVBUF);
temp += n;
if (n>0)
Write(outfile, buf, n);

current = time(&current); // cps calculation
current -= start;
cps = temp/current;
} while(n); // receive loop

(temp holds the bytes received)
-----------CUT HERE-------------

Everytime I execute this code it crashes, without the cps calculation it
runs perfectly. Whats wrong with this?

Cu,



Yves Grabowsky
*ICQ:* 18762984

*AmiURLRequester 2.0 out now! Go and get it!*

Author of AminetFTPMail, AminetGetFTP, AmiURLRequester and SeekHTTP

*http://members.tripod.com/~rexxmaster/*

*http://www.iceman.nu/rexxmaster/*

AMIGA rulez!