i searched the forum but to no avail.

my problem is that i have a stream of unending data coming through a port. the stream is in chunks terminated by a "\n".

i want to read it, take away the unchanging parts and print the rest into a file.

i´ve managed to read the data and was thinking of copying it to another string and then manipulating it. however, i´ve become unstuck here and need some help. i can also write the stream to a file without any problems.

so far, i have
Code:
#include <stdio.h>

//***reads input one character at a time from the input stream called "uncoded"***//

int main( void )
{
   char uncoded[BUFSIZ];
   int i, ch;

   /* Read in single line from "stdin": */

   for( i = 0; ((ch = getchar()) != EOF) 
                        && (ch != '\n'); i++ )
   uncoded[i] = (char)ch;

   /* Terminate string with null character: */

   uncoded[i] = '\0';



}

............ 

//
//**************Writes contents of decoded string to the appropriate file**************/
	
    fputs ( decoded, fp );

//******************Closes the file and waits for next cycle*************************/

    fclose ( fp );
this will take the data from the stream and copy it to the "uncoded" string. i have to copy it to another string "decoded" and then write it.

for example, the data coming through the stream is:

"cabbage 123456789 (random stuff) 1233456789 cabbage"

i want to isolate the (random stuff) part. another problem is that its not always in the same place so i have to actively look for it.

any help would be appreciated.