Is there a function that will return the filenames in the user partition of the CF? I want to use this for example to show it on the operating panel and to choose the file that I want to open.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You should use functions from SysLibDir library to work with PLC's filesystem and SysLibFile library to handle file operations. Make sure these libraries are supported in your target system.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This target uses SyslibfileAsync.lib but this is not the problem.
My problem is to enter the filenames in an array without knowing their names and thus without knowing their addresses.
The result must be to be able to browse the root directory on the CF from the HMI. Rexroth has such functionality inserted in some of their standard programs like Indramotion for Handling but it is very hard to follow the program because of all the structures from the specific program.
My question is if someone else has managed to create such an application for listing the files.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry, I was wrong and SysLibDir library doesn't solve your problem.
Maybe your target system supports some library that can execute system commands. For example see the target Codesys SP PLCWinNT, library SysLibOS.lib, function Sys_Execute_Command```
( Execute system command and returns system result )
FUNCTION Sys_Execute_Command : DINT
VAR_INPUT
Β Β pszCommand : STRING;Β Β ( COmmand line to execute as system command )
END_VAR
VAR
END_VAR
I am using a BoschRexroth L10
Is there a function that will return the filenames in the user partition of the CF? I want to use this for example to show it on the operating panel and to choose the file that I want to open.
You should use functions from SysLibDir library to work with PLC's filesystem and SysLibFile library to handle file operations. Make sure these libraries are supported in your target system.
This target uses SyslibfileAsync.lib but this is not the problem.
My problem is to enter the filenames in an array without knowing their names and thus without knowing their addresses.
The result must be to be able to browse the root directory on the CF from the HMI. Rexroth has such functionality inserted in some of their standard programs like Indramotion for Handling but it is very hard to follow the program because of all the structures from the specific program.
My question is if someone else has managed to create such an application for listing the files.
Sorry, I was wrong and SysLibDir library doesn't solve your problem.
Maybe your target system supports some library that can execute system commands. For example see the target Codesys SP PLCWinNT, library SysLibOS.lib, function Sys_Execute_Command```
( Execute system command and returns system result )
FUNCTION Sys_Execute_Command : DINT
VAR_INPUT
Β Β pszCommand : STRING;Β Β ( COmmand line to execute as system command )
END_VAR
VAR
END_VAR
Example for linux-like platforms:```
ls -a > somefile.txt
```
It's not elegant, but it should work.
I just found my problem
It seems that I will need a library like Syslibdir but one that works in async mode. There is such a thing?
All SysLib* libraries are platform-depended. Call your PLC manufacturer to get support.