#include "listclas.h"
void D_List::seek(long where, int start)
{
long count;
switch(start)
{
case SEEK_SET:
top();
for (count = 0; count < where; ++count)
{
if (at_end())
break;
next();
}
break;
case SEEK_CUR:
if (where > 0)
{
for (count = 0; count < where; ++count)
{
if (at_end())
break;
next();
}
}
else
{
for(count = 0; count > where; ++count)
{
if (at_top())
break;
prev ();
}
}
break;
case SEEK_END:
end();
for(count = 0; count > where; ++count)
{
if (at_top())
break;
prev ();
}
break;
}
}
long D_List::total ()
{
long thisone, count;
thisone = tell();
top();
count = 0;
do
{
if ( ! at_end() )
{
++count;
next();
}
} while( ! at_end() );
seek(thisone,SEEK_SET);
return(count);
}
// End of File