0
how to read a text file from another file?
as i said in the tittle can you guys tell me how to read a text file from another file of c++?? i mean i have made a new c++ project and i was trying to read a text file from another c++ that i have made before. (both of the files are exist inside a files on the desktop).
19 Answers
+ 1
Saurabh Tiwari i will try that now.
0
Saurabh Tiwari yeah you are right, but my question is that for example if you made a file then u made a new c++ project how i would read a text file that's not exist in the same document of the new project? ( i hope that you got what i meant im bad at explaining i guess XD)
0
Saurabh Tiwari ok i will try to write it here, my files are on pc so yeah... XD
0
this is it almost Saurabh Tiwari .
its so simple XD ( im a new learner)
https://code.sololearn.com/ce3KXfriTSvA/?ref=app
0
Saurabh Tiwari to be more specific the problem the complier cant read my text file
0
Saurabh Tiwari can you just tell me the way to tell the compiler about my file location? just to be sure .
0
Bennett Post i have put this already i just have copied it from the file place and pasted that's enough right?
0
Saurabh Tiwari should i add them? i didnt know that i will try that soon, ty guys
0
Saurabh Tiwari Bennett Post i gonna eddit my code and put my original code 1 min .
0
Saurabh Tiwari i have edited my code take a look please, the result is failed .
0
Saurabh Tiwari LOL😂
0
Saurabh Tiwari dude im sure that the problem in that the compiler cant recognize my text file idk if what im doin is something wrong or idk cuz im new learner but what ik that the compiler cant read my text file XD. that what does is_open proves
0
Saurabh Tiwari btw i forgot something important the compiler says :
Error incomplate universal charecter name .
and warning : unknown escape sequence :'\H
and
warning : unknown escape sequence :'\D.
and yeah i tried what you said that didnt work, is that possible that my location that i put is wrong? how to be sure that its right?
0
Saurabh Tiwari all what i should do is 1 click and he gonna show me the location all what i had to do is copy and paste it without any changes right?
0
that what i have done but nah XD
0
i started feel stupid LOL what's wrong with that code omg
0
Bennett Post trust me when i said that i have tried it XD
0
i guess im doing something against c++ rules XDDD LOL
0
just a last explaining in case if it would help, i have made my file text throw c++ then finished it the result was typing an id with a name and an amount lf money, it was successful, then i have close the folder and made NEW FOLDER (all this on desktop) and a NEW C++ PROJECT this project have the code that i showed you guys .
Saurabh Tiwari Bennett Post