Hello. I was wondering how to read strings from a file word by word and store the words into an array in c. I am having to write a program that tests words to see of they are palindromes from a little paragraph i wrote in a file. I've been trying to figure it out all afternoon with no luck.:(
bemo55 0 Newbie Poster
Recommended Answers
Jump to Postfgets and strtok would be good places to start. Do you know how many strings you will be reading? If you don't it will make the array part a little more difficult.
Jump to PostI hate to sound like a prick but... using fscanf is generally a bad idea. There are plenty of reasons, but a big one is that most people don't really understand what its doing. Therefore it usually only works with carefully formatted input. Or by accident.
All 6 Replies
death_oclock 103 Posting Whiz
jen140 0 Junior Poster
death_oclock 103 Posting Whiz
bemo55 0 Newbie Poster
bemo55 0 Newbie Poster
bemo55 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.