I am currently using MinGW in Windows XP.

I coded a program that takes user's input and puts them into .txt file through 

```
typedef struct data_base{
    char name[254];
    int age;
    int postalcode;
    struct data_base *next;
}person;

```

I was wondering if there is a way to edit the data of the .txt file.

For example, in the .txt file, I have 3 sets of data based on user's input:

```
Steven    //name
19        //age
1100      //postal code
Jack 
24
2203
Mary
21
0109

```

I will ask the user which set of data he wishes to edit. Then after taking the edited data, I want that data to be overwritten in the .txt file at that specific set which user selected.

---

```
#include <stdio.h>
#include <stdlib.h>

typedef struct data_base{
    char name[254];
    int age;
    int postalcode;
    struct data_base *next;
}person;

void read()
{
person *curr[20];
int count = 0;
FILE *f;
int editchoice = 0;

f = fopen("personfile.txt","r+");
// Read the data in the file based on user's input

//Display the names: 1. Steven 2.Jack  3.Mary
printf("Editing Whose Data?: \n");
scanf("%d",&editchoice);    

printf("New name: \n");
scanf("%s",&curr[editchoice]->name);
fprintf(f,"%s\n",curr[editchoice]->name);

printf("New age: \n");
scanf("%d",&curr[editchoice]->age);
fprintf(f,"%d\n",curr[editchoice]->age);

printf("New name: \n");
scanf("%d",&curr[editchoice]->postalcode);
fprintf(f,"%d\n",curr[editchoice]->postalcode);

}

```

I expected the data to be overwritten but it isn't happening. (Sorry for being a beginner.)