Mail Archives: djgpp/1999/12/21/17:14:40
On 21 Dec 99, Joanna Baldacci was found to have commented thusly:
> sorry for my ignorance, but '\n' and '\0' don't seem to work. I also tried
> '^p', which someone told me was the answer. Any replies welcome. All I want
> to do is to use it to end some input. The symol for the 'esc' key would be
> just as handy.
The keyword 'return' is not used to stop input processing, but rather to
return from a called function, specifying its value if the function
returns some sort of value.
If you want to halt input processing, you need to make a call to the
appropriate stdio family of functions which control input, each of which
have different conditions for returning from their calls, effectively
ending the input, and returning it to the calling function. You will want
to read about the details of the input functions: fgetc() gets a charater
from any file/stream; getchar() gets a character from the file/stream
known as standard input; fgets() collects a sequence of characters from a
file/stream into an array you specify, either up to the limit of the size
of the array which you specify or when next input character is a '\n',
whichever comes first; fread() reads from a stream of a number of data
blocks/objects, both the number and size of blocks/objects which you
specify, into an array you pass to it. Other functions include
(f)scanf(). These are probably the most useful and portable functions you
can use, and you will want to become familiar with their details.
The response to input control characters varies with different systems
where standards are not defined for them. Trying Ctrl-C on program
developed with DJGPP will certainly end your input.
> thanks
>
> joanna
Mitch Halloran
Research (Bio)chemist
Duzen Laboratories Group
Ankara TURKEY
- Raw text -