problem collecting data from input file
Hello to all.
I am unable to collect data from my input files. The format of the input files is standardized.
the format is something like this:
>blah blah blah
I need to be able to take the info after the ">" and store in a structure called
loadedSequences.name and then take the characters after that and store in
a structure named loadedSequences.data.
I am able to deal with input files and get the first part but unable to collect the second part.
Here is the relevant code:
Any help would be great.
if( (strcmp ( command, "read" )) == 0 )
filename = strtok(NULL, " \t\n" ) ; // collect filename
if( filename )
input = fopen(filename, "r") ;
if ( !input )
fgets( header_data, 1000, input) ;
seqName = &header_data ; // After the > in FASTA format
(char *) malloc( ( strlen(seqName) + 1 ) * sizeof( char ) ) ;
strcpy( loadedSequences[nSequences].name , seqName ) ;
// Collect the sequence from FASTA file
loadedSequences[nSequences].data[n++] = 0 ;
while (c = getc(input) != EOF)
if(c >= 'A' && c <= 'Z')
loadedSequences[nSequences].data[n++] = c ;
loadedSequences[nSequences].length = strlen((loadedSequences[nSequences].data)) ;