Created
December 14, 2018 02:36
-
-
Save adrianparvino/4fa761dfbc15a7fea2d9f4d03a9d4d70 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include"common.h" | |
#include<stdio.h> | |
#include<stddef.h> | |
void prompt_( char *prompt, char *dest, size_t count ) | |
{ | |
fprintf(stderr, "%s ", prompt); | |
char ch; | |
while(count-- > 0 && (ch = getchar()) != '\n') | |
{ | |
*(dest++) = ch; | |
}; | |
ungetc(ch, stdin); | |
while((ch = getchar()) != '\n'); | |
} | |
void prompt( char *original, | |
char *query, | |
char *replacement ) | |
{ | |
prompt_("What is the original string?", original, 80); | |
prompt_("What is the query string?", query, 10); | |
prompt_("What is the replacement string?", replacement, 10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment