How to write data to a text file without overwriting the current data

前端 未结 8 876
南笙
南笙 2020-12-15 18:00

I can\'t seem to figure out how to write data to a file without overwriting it. I know I can use File.appendtext but I am not sure how to plug that into my syntax. Here is m

8条回答
  •  鱼传尺愫
    2020-12-15 18:29

    Look into the File class.

    You can create a streamwriter with

    StreamWriter sw = File.Create(....) 
    

    You can open an existing file with

    File.Open(...)
    

    You can append text easily with

    File.AppendAllText(...);
    

提交回复
热议问题