On Sat, 19 Sep 1998, subbaraom wrote:
> On Thu, 17 Sep 1998, Glynn Clements wrote:
>
> -> if(n==25 || n==50)
> -> {
> -> printf("hit enter for the next page..\n");
> -> getchar();
> -> }
> -> }
> ->
> -> but it didn't work, has anyone got a solution to my little problem?
> -
> -In what way didn't it work? If it never prints the message, then it's
> -due to something in the `//other functions' section.
>
> and consider resetting n to 0 after each screenful. That way you don't
> need to check for n==25 || n==50 || n==75.....
>
> if (n > 24) {
> printf ("Press <enter> for next page...\n");
> getchar();
> n=0; /* because we all know the screen really goes from 0->24 */
> }
> [subbaraom] Why don't you use % (mod opearator) in the following way
> if ((n % 25) == 0) {
> printf("Press <enter> for next page ... \n);
> getchar();
> }
> --
Good idea using the mod operator i think.
Does anyone know if there is a function getline() in C which acts like
the C++ iostream function cin.getline(STRING, SIZE, DELIMITER); ?
That way you could simply set the SIZE as 25+1 for null, right?
#include <iostream.h>
#define SIZE 25+1
#define TRUE 1
#define FALSE 0
void main()
{
char test_str[SIZE];
while(cin.eof != TRUE)
{
cin.getline(test_str, SIZE, '\0'); //i think NULL
//is the default delimiter?
cout << test_str; //or whatever you wanted to do with it
}
}
Sorry if any of this has been repeated or thrown out already, i just
jumped into this problem and i don't have the previous mails.
Best Regards,
Dan
UMCP