Hi,
I want to open and write a file in binary mode
Seems SysFile.lib doesn't support this option, can anyone give me some advice?
Another question is, what's the difference between SysFile.lib and SysLibFileAsync.lib?
Thank you very much
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi~
For example, when I write character A
I want it to be recorded as 01000001(0x41) in binary mode
And be recorded as A in text mode (ascii mode)
Can I achieve this with codesys libs ? Thank you
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please read some ascii and file storing documentation before posting β¦ GIYF
There are no characters stored in files. Only bits are. ASCII is a way of interpreting those bits.
so recording "A" character in a file, with text mode or binary mode, as long as you are in ASCII encoding, will produce 01000001(0x41) in your file.
Then reading it, it will be read bytes per bytes. binary mode and ascii mode. binary mode will show the raw value 0x41 while ASCII will show you decoded ascii char -> "A"
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Zitat:
Another question is, what's the difference between SysFile.lib and SysLibFileAsync.lib?
looking into the documentation area of SysFileAsync you can read, that this library is a "wrapper" for SysFile to handle asynchronous access to file functions. That means, the requested function will be processed in the background, and in your program you have to wait for the result. This may last some time, depending on the function and your hardware etc.
The big advantage is that your application program is not interrupted by a slow file access, which might cause trouble in your machine.
Best regards
Alfred
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I want to open and write a file in binary mode
Seems SysFile.lib doesn't support this option, can anyone give me some advice?
Another question is, what's the difference between SysFile.lib and SysLibFileAsync.lib?
Thank you very much
As almost all devices don't run Windows plateforms, this topic suggest it's the same :
https://stackoverflow.com/questions/229924/difference-between-files-written-in-binary-and-text-mode
Hi~
For example, when I write character A
I want it to be recorded as 01000001(0x41) in binary mode
And be recorded as A in text mode (ascii mode)
Can I achieve this with codesys libs ? Thank you
Please read some ascii and file storing documentation before posting β¦ GIYF
There are no characters stored in files. Only bits are. ASCII is a way of interpreting those bits.
so recording "A" character in a file, with text mode or binary mode, as long as you are in ASCII encoding, will produce 01000001(0x41) in your file.
Then reading it, it will be read bytes per bytes. binary mode and ascii mode. binary mode will show the raw value 0x41 while ASCII will show you decoded ascii char -> "A"
Hi eric,
looking into the documentation area of SysFileAsync you can read, that this library is a "wrapper" for SysFile to handle asynchronous access to file functions. That means, the requested function will be processed in the background, and in your program you have to wait for the result. This may last some time, depending on the function and your hardware etc.
The big advantage is that your application program is not interrupted by a slow file access, which might cause trouble in your machine.
Best regards
Alfred
Thanks for the reply/suggestions
It's helpful and corrected some of my concept