Hello I need to enter a string of the form abc[EOF] (a string of
characters followed by EOF)
#include<stdio. h>
#include<stdlib .h>
#include<string .h>
#define MAX 100
int main(void)
{
char arr[MAX];
puts("Enter String :");
fgets(arra,100, stdin);
/*Do Something*/
puts("");
return 0;
}
Is there any way i can do this ?The code i pasted above halts once an
EOF is entered.Is there any way to prevent the program from halting for
any further input ?
Actually this is a part of a bigger question where i am trying to parse
a string ( to validate user entered int/double etc )
A Simple EOF is easy to handle but if the EOF is entered after a set of
characters the program waits for a further input!!
What is the right way to handle such an input ?
characters followed by EOF)
#include<stdio. h>
#include<stdlib .h>
#include<string .h>
#define MAX 100
int main(void)
{
char arr[MAX];
puts("Enter String :");
fgets(arra,100, stdin);
/*Do Something*/
puts("");
return 0;
}
Is there any way i can do this ?The code i pasted above halts once an
EOF is entered.Is there any way to prevent the program from halting for
any further input ?
Actually this is a part of a bigger question where i am trying to parse
a string ( to validate user entered int/double etc )
A Simple EOF is easy to handle but if the EOF is entered after a set of
characters the program waits for a further input!!
What is the right way to handle such an input ?
Comment