Well, it's been a lonngg time since I've last been on DaniWeb and everything looks different. Anyway, I'm having a bit of a brain fart I suppose so I'm hoping someone can help me out. I've been working on this program that basically reads in a fasta file with multiple sequences and breaks it up. I've had it so that it can spit it out into multiple files, then I changed it to use dynamically allocated memory and an array of my "sequence" objects and now i just display the results on the screen. Now I want to make an educated guess as to whether each sequence is dna, rna, or a peptide and store it as an enumerated type in the sequence structure. I think I have part of it correct as far as adding an enum to my struct. However, I'm lost as to how to access it in my sequence object. Below is a snippet of what i have:
typedef struct { char *accession; char *data; enum {RNA, DNA, PEP} seqType;} Sequence ;
Sequence newSequence( char *acc, char *data)
{
Sequence returnSeq ;
returnSeq.accession = (char *) malloc( ( strlen( acc ) + 1 ) * sizeof( char ) ) ;
strcpy( returnSeq.accession, acc ) ;
returnSeq.data = (char *) malloc( ( strlen( data ) + 1 ) * sizeof( char ) ) ;
strcpy( returnSeq.data, data ) ;
return returnSeq ;
}
Any help is greatly appreciated.