Hi, I need help in how do we add new data into a text file. But then the file has only a limit for 20 students. If there is no space for another new student, replacing the No.1 student into the new student detail is required. For example;
In a text file
No student year
1 chris 2nd
2 hanna 1st
The question now is that, I don't know how to enter the new student detail without changing the No.1 student. And if the limit has passed, I don't know how to replace the No.1 student into a new student. Can someone help me?
So far I only managed to write in the No.1 student only into the text file.
I don't really understand what you are saying, and I don't really understand why you had to split it up into 3 posts, but couldn't you just put all of the students into an array before writing them to a file, and just write the last 20 of them? If the file is opened in write mode, it should overwrite all previous content so the student list having changed should be a non-issue.