I tried to store a simple txt file into configuration using hello-plc C++ example from SDK 1.8, but it doesn´t work.
1. I added the plug as described:
2. I tried to store the txt file to the following paths I found in some community posts, but none of them worked for me:
- filepath: $SNAP_COMMON + /solutions/activeConfiguration/helloplc
Via configurations (web interface) I see also no configuration for my helloplc snap. 😞
Could you send me a small code example which explains how to add a file (txt or json) from hello plc C++ snap to configuration?
Thank you very much!!
Go to Solution.
To simply store a file in the active configuration add the plug to your .yaml file:
And then use following code:
///// test /////
path = "/var/snap/rexroth-solutions/common/solutions/activeConfiguration/test.txt";
std::cout << "write " << path << std::endl;
std::ofstream outfile (path);
std::cout << "opened: "<< path << std::endl;
outfile << "Test txt with some words\nand two lines\n" << path;
std::cout << "error: " << path << std::endl;
If you like to be part of the automatic save and load process of the configuration some more steps have to be done. To get more information please get in contact with your ctrlX World contact person.