我用C ++更新txt文件中的数据

我想使用C ++更新我的txt文件中的数据,这是解释: .txt文件的格式如下:

khanh 123456 0
lien 124123 1
hahaha 125225 0

Each line represent of one accout, fist word is username, affter is is password and final is status of this accout (0 is actice, 1 is blocked). Ex: line 2: username is lien, password is 124123 and status is 1
And i want to update the status of one accout base on its username.
Ex: i what to change the status of accout hahaha from 0 to 1 when i have string (or array char) contain the string hahaha (ex: string = "hahaha" or char* arry = "hahaha")
How can i do that, i find solution but i can't still do that, somebody can help me, How to update the character in .txt file like this.

评论