On 2 Jan 2010, at 16:52, Ivano_Morrone wrote:

> I'm using the following piece of code (received some time ago from  
> Ian) to call from file txt frequency values which my audio sinth  
> reads and therefore with them produces sounds.

Yuck - that's a bit rough and ready! Did I really write that!


> At the moment I'm able to go to next line and so on up to EOF and  
> then read the file from the beggining. I'm not able to return to a  
> previous line from a next line. I'm trying to implement some method  
> to do it.
> I appreciate your suggestions to solve the problem

You probably want to use the ftell() function to record the position  
of each line when you read it - then you can use fseek() to go back  
to that line at a later time...

So at or near this point you could maybe do something like this...

> next_line:

   // record the previous line position
   long old_line = ftell(fp_123);

>  // get the next line from the file
>  char *pc = fgets(values, 1024, fp_123);


Then, at some later time, if you want to go back to that line you  
would do something like...

go_back_to_old_line:
   fseek(fp_123, old_line, SEEK_SET);// rewind to previous line
   // read the line
   pc = fgets(values, 1024, fp_123);

and so on...

Of course, you can probably store all the line numbers found by ftell 
() into an array and use that to jump directly to any line in the  
file, and so on...




_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to