Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define LIMIT 100
- void main()
- {
- char s[LIMIT];
- bool terminate=false;
- const char termChars[] = {EOF, '\n', '\r', '\e', 0};
- for(int i=0; i<LIMIT && terminate==false; i++)
- {
- c=getchar();
- for(int j=0; termChars[j]!=0 && c!=0; j++)
- {
- if(c==termChars[j])
- {
- c = 0;
- terminate = true;
- }
- }
- s[i]=c;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment