Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char name[64];
- int main(int argc, char*argv[]) {
- char message[64];
- FILE *fp;
- setvbuf(stdout, NULL, _IONBF, 0);
- printf("Enter your name: ");
- fgets(name, 63, stdin);
- printf("Enter your message: ");
- gets(message);
- fp = fopen("messages.txt", "a");
- if(fp == NULL) {
- printf("Whoops, message not delivered ;(\n");
- return 1;
- }
- fprintf(fp, "Message from %s: %s\n", name, message);
- fclose(fp);
- printf("Your message has been sent to admin, bye!\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement