Forum Migration Notice
We're transitioning to a more modern community platform by the end of this year. Learn about the upcoming changes and what to expect.
Get an exception when trying to load txt file using PutFile
egor
✭
Hi,
I'm trying to load listbox items names from database.txt, which is located in the HOME/Database directory on real robot controller.
I get an exception "SYS_CTRL_E_FILE_NOT_FOUND" (File not found or could not be opened for reading). What am I doing wrong?
//Creating controller object
I'm trying to load listbox items names from database.txt, which is located in the HOME/Database directory on real robot controller.
I get an exception "SYS_CTRL_E_FILE_NOT_FOUND" (File not found or could not be opened for reading). What am I doing wrong?
//Creating controller object
public static Controller aController = new Controller();
//Loading listbox items from txt
private void TpsViewDatabase_Load(object sender, EventArgs e)
{
//Accessing files and directories
FileSystem aFileSystem = aController.FileSystem;
//Creating remote directory
aController.FileSystem.RemoteDirectory = "HOME/Database";
string remoteDir = aController.FileSystem.RemoteDirectory;
aController.FileSystem.LocalDirectory = "c:/temp";
//Saving txt to controller remote directory
aController.FileSystem.PutFile("database.txt", remoteDir);
using (StreamReader sw = new StreamReader(remoteDir + "/database.txt"))
{
listViewItem1.Text = sw.ReadLine();
listViewItem2.Text = sw.ReadLine();
listViewItem3.Text = sw.ReadLine();
...
}
}
}
//Exiting
private void button1_Click(object sender, EventArgs e)
{
//this.Hide();
this.CloseMe();
if (aController != null)
{
aController.Dispose();
aController = null;
}
}
Regards
Regards
0
Categories
- All Categories
- 5.6K RobotStudio
- 401 UpFeed
- 21 Tutorials
- 15 RobotApps
- 306 PowerPacs
- 407 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.9K Robot Controller
- 365 IRC5
- 84 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 854 RAPID Programming
- 37 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 110 Collaborative Robots
- 5 Job listings