just a quick question.
i have been working on this code which reads a file that contains information about each frame for animation (blm files). my code is controled my a GUI(slider) and then uses fseek() to locate the frame to be read. a bit like a scraching.
my questions is that, does fseek() eats a lot of cpu power? for example, i tried to cahnge the slider value continusly and the cpu power went stright up.
many many thanks
my code looks like this:
static void blinkenlights_goto(t_blinkenlights* x, t_float frame)
//where the frame comes from the GUI range 0->1
// where x->framge_pos is any array which remembers the position
// if each frame in the file x->filed
char *lineread = (char*) getbytes( BL_MAX_LENGTH );
int current_frame = x->frame_pos[(int)(frame * (x->frame_no-1))];
int i, n;
if(frame < 0) post("no negtive numbers, please...");
// this is the line that i think is eatting up my cpu!!!!!!
fseek(x->x_filed, current_frame, SEEK_SET);
fgets(lineread, BL_MAX_LENGTH, x->x_filed );
if ( (lineread == '\n')) break;
for(n=0; n<(strlen(lineread)-1); n++)
if(lineread[n] == '0')blinkenlights_pixoff( x, n+1, i+1);
else blinkenlights_pixon( x, n+1, i+1);
//if(lineread[n] == '0')blinkenlights_pixoff( x, n+1, i+1);
//else blinkenlights_pixon( x, n+1, i+1);
//fseek( x->x_filed, 0L, SEEK_SET );
if ( lineread ) freebytes( lineread, BL_MAX_LENGTH );