Basics of assignment
I don't know how to reference across projects, and my developer lingo is still too underdeveloped for me to conduct a worthwhile Google search. I simply don't know how to reference a relative path that keeps things contained. I only know how to reference an absolute path:
StreamWriter outputfile;
outputfile = File.AppendText(@"C:\Users\...some-file-path...\Homework2\responses.txt)
Or deeper if it's in the bin\\debug folder. Speaking of, I don't care if it's in the debug folder of one project or another, or in the main solution folder.
I just want it to work since it's homework (although an explanation of common industry best practices would not be unappreciated, even though I'm going into IT). How do I reference the solution folder as the start of the path to which I need to find a file? I would ask if that's possible, but I know the reality of programming is that anything is possible if you're just willing to put enough knuckle grease into the project.
You can use ..
to go up a directory relative to the current one. So going from C:\\Windows\\Temp
using ..\\..\\ProgramData
would get you to C:\\ProgramData
.
The current dir is referenced with .\\
for going downwards in the tree. So using the previous example .\\Temp1
would get you to C:\\Windows\\Temp\\Temp1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.