how to read a text file from another file? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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).

13th Jan 2019, 4:44 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
19 Answers
+ 1
Saurabh Tiwari i will try that now.
13th Jan 2019, 6:54 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
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)
13th Jan 2019, 5:27 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
0
Saurabh Tiwari ok i will try to write it here, my files are on pc so yeah... XD
13th Jan 2019, 5:37 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
0
this is it almost Saurabh Tiwari . its so simple XD ( im a new learner) https://code.sololearn.com/ce3KXfriTSvA/?ref=app
13th Jan 2019, 5:46 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
0
Saurabh Tiwari to be more specific the problem the complier cant read my text file
13th Jan 2019, 5:52 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
0
Saurabh Tiwari can you just tell me the way to tell the compiler about my file location? just to be sure .
13th Jan 2019, 6:15 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
0
Bennett Post i have put this already i just have copied it from the file place and pasted that's enough right?
13th Jan 2019, 6:33 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
0
Saurabh Tiwari should i add them? i didnt know that i will try that soon, ty guys
13th Jan 2019, 6:34 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
0
Saurabh Tiwari Bennett Post i gonna eddit my code and put my original code 1 min .
13th Jan 2019, 6:38 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
0
Saurabh Tiwari i have edited my code take a look please, the result is failed .
13th Jan 2019, 6:39 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
13th Jan 2019, 6:44 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
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
13th Jan 2019, 6:47 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
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?
13th Jan 2019, 6:59 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
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?
13th Jan 2019, 7:02 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
0
that what i have done but nah XD
13th Jan 2019, 7:04 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
0
i started feel stupid LOL what's wrong with that code omg
13th Jan 2019, 7:05 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
0
Bennett Post trust me when i said that i have tried it XD
13th Jan 2019, 7:08 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
0
i guess im doing something against c++ rules XDDD LOL
13th Jan 2019, 7:09 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar
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
13th Jan 2019, 7:11 PM
Ặňặ Ǯǿmry MặƧđař Ặnśậk
Ặňặ Ǯǿmry MặƧđař Ặnśậk - avatar