In the program I'm writing I'm having a bit of a problem. The program is reading in a number of strings from an input file and placing them into a character array, malloc-ing the memory, then analyzing them in a number of different ways. However, I can't read in the strings before I declare the character array, and that's where I encounter my problem. Now I know each string will be less than one 'line' long i.e. less than 80 characters or so. The question is, how would I setup a while loop to determine the number of strings? Here's the input file, but obviously it's going to need to work with any number of input files.
It's a palindrome project, hence some of the odd strings. Basically, I'm trying to figure out how to setup a loop that would determine I need an array of size 14 after reading that data file? Any tips appreciated!Code:palindromes String manipulation and recursion Otto Command-line arguments Anna file handling and dynamic memory allocation Able was I ere I saw Elba ctype.h Madam, I'm Adam. Use of menus: Integer vs. Character input Array of strings? Looking for EOF? Was it a cat I saw? A man, a plan, a cat, a canal: Panama?



LinkBack URL
About LinkBacks


