Skip to content

Tutorial 8 TextFileIO Code Change #1

Open
pateln50 opened this issue Oct 11, 2019 · 1 comment
Open

Tutorial 8 TextFileIO Code Change #1

pateln50 opened this issue Oct 11, 2019 · 1 comment

Comments

@pateln50
Copy link

pateln50 commented Oct 11, 2019

In the code on moodle to see where the execution (cwd) paths is use:

int main(int argc, char** argv)
{
     // This should show the CWD / execution path of the code
     std::cout << argv[0] << std::endl;
     //........
} 
@aa6164
Copy link
Contributor

aa6164 commented Oct 11, 2019

Updated the code on Moodle to include this and the new C++17 filesystem library:

#include <filesystem>

using namespace std;

int main(int argc, char* argv[])
{
	cout << "being exectued from:" << endl;
	cout << argv[0] << endl;
	
	std::filesystem::path cwd = std::filesystem::current_path() / "filename.txt"; // C++17
	cout << "but the input.txt and output.txt files should be be in the following directory:" << endl;
	cout << cwd.string() << endl << endl;
// etc...

Will add source code and perhaps slides to a new CU GitHub repo at a later date.

Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants