+ 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?
5 odpowiedzi
+ 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/
+ 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 \\
+ 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 👍).
+ 3
Faisal nAutAxH AhmAd Thank you very much for your help🙏🙏🙏🙏🙏
+ 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😭