Code:#include< stdio.h > #include<windows.h> void main() { char c[4]; int cnt, i, len; FILE *fd; fd = CreateFile("d:\\data13.txt", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (fd == NULL) { printf("file doesnt exist"); } else { //do //{ for (i = 0; i <= 4; i++) { c[i] = getchar(); } c[i] = '\0'; //}while(!EOF); WriteFile(fd, c, strlen(c), NULL, NULL); //fwrite(c,strlen(c),1,fd); fputc('\0', fd); fclose(fd); } c[0] = '\0'; fd = fopen("d:\\data1.txt", "r"); if (fd == NULL) printf("do exist"); else { fread(c, sizeof(char), 1, fd); printf("%5s", c); } fclose(fd); }