how do I morse code converting program
I was wondering if anyone could help me with this... I'm trying to write a program that takes an input txt file, reads a line (either in english or in morse code ( ie --.- ) and converts it to its counterpart...
I wrote a code that can scan the data one line at a time, I want to test the line to see if it consist of letters, or dashes and dots (morse code) so I can send it to an appropriate function to convert it....
I can't figure out how to test for this though, I'm trying to make a conditional statement say
Code:
if( line == char )
{}
does anyone know a way I may be able to test for this...
so far my code looks like this
Code:
main() {
FILE *fin,*fout;
fin = fopen("morse.txt","r");
fout = fopen("morse_out.txt","w");
char line[Max_Size + 1]; /* This is used to store the output lines */
while ( fgets( line, Max_Size + 1, fin ) != NULL )
{
fprintf(fout,"%s", line);
fprintf(fout,"WHERE", line);
}
}
it says where cause I am trying to get it to stop after it reads a line so i can test it
thank you, any help/suggestions are greatly aprreciated