+ 2

Files in c++

I want to create/read/write a text file in a specific directory like c drive(c:). Anybody show me the solution?

5th Nov 2018, 1:11 PM
LetterC67
LetterC67 - avatar
5 Antworten
+ 8
Hey 🇻🇳GNAOH🇻🇳 ! The C++ course covers this topic, so I would recommend going through and finishing it as the course explains exactly what you need help with. https://www.sololearn.com/learn/CPlusPlus/1921/ https://www.sololearn.com/learn/CPlusPlus/1920/
5th Nov 2018, 1:16 PM
Faisal
Faisal - avatar
+ 8
🇻🇳GNAOH🇻🇳 Remember backslash is also used in Escape sequences so if you use single backslash the compiler will skip it so you need to use double backslashes \\
5th Nov 2018, 6:21 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 6
As the \ character represents an escape character (being combined with the next letter to make character such as \n, \r, etc.), you would need to enter 2 \ characters to be able to essentially cancel out the escape character and just have a backslash in your string (just replace all instances of one backslash to 2 and it should work 👍).
5th Nov 2018, 1:58 PM
Faisal
Faisal - avatar
+ 3
Faisal nAutAxH AhmAd Thank you very much for your help🙏🙏🙏🙏🙏
5th Nov 2018, 11:41 PM
LetterC67
LetterC67 - avatar
+ 2
Faisal When i use ofstream files ("abc.txt"), it's working properly, abc.txt was created but when i change "abc.txt" to "c:\abc.txt", nothing happen😭
5th Nov 2018, 1:44 PM
LetterC67
LetterC67 - avatar