Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(){
- FILE *fptr;
- char input[81], filename[20];
- printf("請輸入欲寫入的姓名: ");
- gets(filename);
- fptr = fopen(filename, "w");
- puts("請輸入字串,當字串為 quit 表示結束:\n");
- while(strcmp(gets(input), "quit") != 0){
- fputs(input, fptr);
- fputc('\n', fptr);
- }
- fclose(fptr);
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement