Writing functions, with no break statements?

Hey guys!

I'm a newb, so excuse my question.

Alright, I think it is possible, but need some confirmation.

So, here is my question:
Can one write a "so-and-so-function" using no break commands?

lol we need more clear descriptions if possible... i don't understand "so-and-so-function" using no break commands XD
Oh sorry. Ok. Here is more of the description:

What about a readWord function?

as in, to read a word, or to read MS Word file? :/

still does not explain much i'm afraid. could you please define "break commands"?
Break is used to end a loop.

readWord function as in to read text from a notepad file, and give the output and the character count.

oh okay XD apologies... its possible to use them without using break commands.

functions that read text from notepad have an EOF (End Of File). EOF denotes that the notepad has been read until the final part. no more text to read. we utilize this condition in the 'while' loop so it can terminate itself without using break commands.

for example,
1
2
3
while (fscanf(fp, "%s", str)!=EOF)
//or
while (fgets(str, 128, fp)!=NULL)

note that these functions are for C, and there are more advanced functions for C++. also, as you'd probably see, the end for fscanf is EOF, while fgets is NULL. different functions have different way of telling that there is no more text to be read.

hope this answers your question :D
Yes! I thought I was able to do it! Thanks a lot.
you're welcome :D be sure to mark the topic as solved ^_^
Done! Thanks!
Topic archived. No new replies allowed.