You can use fgets(char *s, int Size, FILE *stream)
set Size to equal the approriate value using either a #define or strlen
value and set stream to recieve from either a open file pointer or stdin
etc. s is the stream that data is being placed into. To break up stream, if
you know the input format and are after specific values within s then you
can use sscanf, after the fgets function call.
Reset the line counter to zero after printing a new page etc.
If reading in from a file (assume you are when you say you are making a
database, batch entry is much more efficient) use the EOF test for fgets to
determine when to stop processing through the loop
Kind Regards
Renato Parletta........
To reply send mail to: [EMAIL PROTECTED]
ICQ No: 13078952
"l can only assume that a "Do Not File" document
is filed in a "Do Not File" file."
Senator Frank Church
Senate Intelligence Subcommittee Hearing, 1975
-----Original Message-----
From: Dan Jue <[EMAIL PROTECTED]>
To: Linux C Programming List <[EMAIL PROTECTED]>
Date: Sunday, 20 September 1998 7:00
Subject: RE: prompt when 25 lines..
>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
>