C Program Search Word

Posted on by

Word Search Programs Free

You forgot to declare memory for char *string. Paper Cd Case Template Pdf. Your program tries to write with fscanf(in_file,'%s',string); in unreserved memory causing undefined behavior and then very likely a crash. Xforce Keygen Autocad 2012 32 Bit For Windows 7 more. Replace char *string; with char string[ MAX_WORD_LENGTH ] There are many other problems, for example your search might only work on the first try since you are reading the file every time and once you hit EOF you won't read any more. You should set the position indicator to the beginning of the file with on every search. Fseek ( in_file, 0, SEEK_SET ); Also using instead of strcmp might produce better results.

You're not doing your file I/O correctly. Really, you're better off having initialize() taking a string with the file name: void initialize( const char* filename) then you can call it as: void initialize( 'wordsearch_data.txt') and inside you can open, read, and close the file. You need to use the extraction operator on your stream when reading from file: inputFile >>table[i][j]. Also, it doesn't make any sense to insert inputFile on cout like you do in line 29. It should be just cout.

C - Using C, How will you search for a word in file? If i enter an ID Number it should look in the.txt file the employee who owns that ID Number then it will.