44 lines
842 B
C++
44 lines
842 B
C++
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <windows.h>
|
|
//f means file
|
|
int main(){
|
|
FILE * fp, *fout;
|
|
fp = fopen("test.dat","rb");
|
|
if(fp == NULL){
|
|
printf("Damn!");
|
|
exit(0);
|
|
}
|
|
char arr[100];
|
|
int i=0;
|
|
while(fgetc(fp)!=EOF){
|
|
fseek(fp, -1, SEEK_CUR);
|
|
arr[i] = fgetc(fp);
|
|
i++;
|
|
}
|
|
arr[i] = '\0';
|
|
//printf("%s",arr);
|
|
/*
|
|
for(int i = 0; i < strlen(arr) ; i++ ){
|
|
scanf
|
|
}*/
|
|
// fput();
|
|
fout = fopen("fout.dat","ab");
|
|
for(int i = 0; i < strlen(arr) ; i++){
|
|
fputc(arr[i], fout);
|
|
}
|
|
FILE *f1;
|
|
f1 = fopen("fout.dat","rb");
|
|
while(fgetc(f1)!=EOF){
|
|
//putchar(arr[i]);
|
|
fseek(f1,-1,1);
|
|
putchar(fgetc(f1));
|
|
Sleep(50);
|
|
}
|
|
|
|
fclose(fout);
|
|
fclose(fp);
|
|
|
|
return 0;
|
|
} |