23 lines
579 B
C++
23 lines
579 B
C++
#include<stdio.h>
|
|
#include<stdlib.h>
|
|
|
|
int main() {
|
|
FILE * fp;
|
|
char input[100]={0},cha;
|
|
printf("Input data here under this line\n");
|
|
printf("-------------------------------\n");
|
|
int i=0;
|
|
fp=fopen("/tmp/data.txt","w+");
|
|
while(input[0]!='.'){
|
|
while((cha=getchar())!='\n'&&cha!=EOF){
|
|
input[i]=cha;
|
|
i++;
|
|
}
|
|
input[i]='\0';
|
|
i=0;
|
|
fprintf(fp,"%s\n", input);
|
|
}
|
|
fclose(fp);
|
|
printf("Output has been saved to /tmp/data.txt\nYou can safely close this window now.");
|
|
return 0;
|
|
}
|