Read file from subfolder of application installation folder

前端 未结 4 845
逝去的感伤
逝去的感伤 2021-01-15 11:13

I have to read the text content from an .txt file, this file is located in app installed folder, in a subfolder, according to Microsoft docs, I am doing it like

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-15 12:13

    I think you need to use:

    string txtFileName = @".\myfolder\myfile.txt";
    

    The dot in the filename represents the current folder. In you want to specify using relative paths, then @"\myfolder\myfile.txt" is not correct.

提交回复
热议问题