Skip to main content

Hello community,
I am looking for an example of OPEN / READ / WRITE a binary file in ZPL.
Many Thanks!
Hans-Jürgen 

Hi Hans-Jûrgen,

 

I could be wrong but the Help File for OPEN reads:

Opens an existing text file for reading by the READ command.

 

This is only for text files, not binary files.

Also, I suggest writting binary files with MATLAB or Python. I wrote an example for Sources here in Python.

I hope this helps. Take care,

 

David

 


Hi David,

thanks!

I was in the wrong help section (Tolerancing ) and found OPEN FILE filename mode (mode = [txt,bin]).

That’s pity.

Is it worth to be a support request?

Best Regards

Hans-Jürgen


Hi Hans-Jûrgen,

 

If you want my honest opinion, it isn’t worth it. Reading and writting binary files is a relatively basic task (at least if you know the syntax) in many other more general programming langages including C/C++, C#, MATLAB, Python. Many people, like myself, create our binary files with another langages, which also have a better integrated development environment (IDE). Therefore, I doubt there will be a huge incentive to have it in ZPL in the future. But you can still ask I guess.

Have you had a look at the code I sent you?

Take care,


David


Hi David,

thanks for the honest answer.
My problem is to replace missing MODIFYSETTING myself by manipulating the cfg files.
I might as well outsource that if I could launch a program (.exe) from ZPL (?).

Grüße

Hans-Jürgen


Hi Hans-Jürgen,

 

Could you use the ZOS-API instead? You’d already be in an environment where writing/reading binary files becomes possible. Running executables as well.

Take care,

 

David


Hi David,

thanks. We know that extensions are more powerful.

ZPL is enough for many things. And I like to push the limits.

Ok, for this task / problem we will use ZOS-API.

Viele Grüße

Hans-Jürgen


Reply