i have the text file text.txt containing the following:
john,male,36,libra
jane,female,28,cancer
stive,male,33,gemini
and so on
i am able to read each line and edit its contents
the edited line is assigned to a variable.
what i need is a function that will replace a specific line in the text file with new variable
i tried using fopen, fwrite, fclose but it is deleting everything in the text file.
i have a loop that ammends each line and i would like to include a write function in it.
Thanks,
thanks for that,
this code adds a new line into the text file but what i want is replace a line in the text file without affecting or changing it's order in the list
john,male,36,libra
jane,female,28,cancer
stive,male,33,gemini
and so on
i am able to read each line and edit its contents
the edited line is assigned to a variable.
what i need is a function that will replace a specific line in the text file with new variable
i tried using fopen, fwrite, fclose but it is deleting everything in the text file.
i have a loop that ammends each line and i would like to include a write function in it.
Thanks,
thanks for that,
this code adds a new line into the text file but what i want is replace a line in the text file without affecting or changing it's order in the list