Readfile command to read binary file error!
Forum rules
You might want to read this if you're looking for priority service
Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).
Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.
How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
You might want to read this if you're looking for priority service
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
-
youtao6256
- Posts: 20
- Joined: 21 Aug 2017 06:45
Readfile command to read binary file error!
I would like to use readfile (, "b", 20, 25) command to read the wav file 25,26 bytes of hexadecimal data, but found that the command read the hexadecimal data and source files of the ten Hexadecimal data is not the same? The source file data is 0xAC44, but the incoming data bits 0x3F44, using the pattern “b” or “t” are not correct.
Source file hexadecimal,the wav file 25,26 bytes of hexadecimal data is 0xAC44
script:text hexdump (readfile(, "b",20, ,25),,"b"),1,);
The result of the readfile command. 25,26 bytes of hexadecimal data is 0x3F44
Source file hexadecimal,the wav file 25,26 bytes of hexadecimal data is 0xAC44
script:text hexdump (readfile(, "b",20, ,25),,"b"),1,);
The result of the readfile command. 25,26 bytes of hexadecimal data is 0x3F44
To see the attached files, you need to log into the forum.
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Readfile command to read binary file error!
Don't know where this is coming from, but on my system (german locale), it displays the correct result:
To see the attached files, you need to log into the forum.
One of my scripts helped you out? Please donate via Paypal
-
youtao6256
- Posts: 20
- Joined: 21 Aug 2017 06:45
Re: Readfile command to read binary file error!
my system is win7,64 bit
To see the attached files, you need to log into the forum.
-
admin
- Site Admin
- Posts: 67271
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Readfile command to read binary file error!
1) Do you see the correct values when you view the file with command File | Quick File View (Ctrl+Q)?
2) What is your locale? Please show this section from Help | Various Information:
2) What is your locale? Please show this section from Help | Various Information:
Code: Select all
System Locale ID: 1031 (de-DE)
Thread Locale ID: 1031 (de-DE)
Default ANSI Code Page: 1252 (ANSI - Lateinisch I)
Active ANSI Code Page: 1252 (ANSI - Lateinisch I)
Default OEM code page: 850 (OEM - Multilingual Lateinisch I)
Active OEM Code Page: 850 (OEM - Multilingual Lateinisch I)
Is DBCS Code Page: NoFAQ | XY News RSS | XY X
-
youtao6256
- Posts: 20
- Joined: 21 Aug 2017 06:45
Re: Readfile command to read binary file error!
I know that this bug related to the system area, when the system format is set to Chinese, read the data wrong, set the format for the United States is correct, I am a Chinese user, hoping to solve this problem.
To see the attached files, you need to log into the forum.
-
youtao6256
- Posts: 20
- Joined: 21 Aug 2017 06:45
Re: Readfile command to read binary file error!
I am in China, the language environment is windows7 64bit Chinese operating system, windows10 the same as the problem.
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Readfile command to read binary file error!
Please look at this post (viewtopic.php?p=151761#p151761)
and provide the necessary information
and provide the necessary information
One of my scripts helped you out? Please donate via Paypal
-
youtao6256
- Posts: 20
- Joined: 21 Aug 2017 06:45
Re: Readfile command to read binary file error!
System Locale ID: 2052 (zh-CN)
Thread Locale ID: 2052 (zh-CN)
Default ANSI Code Page: 936 (ANSI/OEM - 简体中文 GBK)
Active ANSI Code Page: 936 (ANSI/OEM - 简体中文 GBK)
Default OEM code page: 936 (ANSI/OEM - 简体中文 GBK)
Active OEM Code Page: 936 (ANSI/OEM - 简体中文 GBK)
Is DBCS Code Page: Yes
Quick File View (Ctrl+Q)
Thread Locale ID: 2052 (zh-CN)
Default ANSI Code Page: 936 (ANSI/OEM - 简体中文 GBK)
Active ANSI Code Page: 936 (ANSI/OEM - 简体中文 GBK)
Default OEM code page: 936 (ANSI/OEM - 简体中文 GBK)
Active OEM Code Page: 936 (ANSI/OEM - 简体中文 GBK)
Is DBCS Code Page: Yes
Quick File View (Ctrl+Q)
To see the attached files, you need to log into the forum.
-
admin
- Site Admin
- Posts: 67271
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Readfile command to read binary file error!
Thanks. Fix comes with next beta version.
FAQ | XY News RSS | XY X
-
youtao6256
- Posts: 20
- Joined: 21 Aug 2017 06:45
Re: Readfile command to read binary file error!
Hi, I have been updated to 18.20.0300 But how does the readfile command read errors?
script:text hexdump (readfile(, "b",50, ,1),,"b"),1,); Look at the location of 18h, 0xAC44 or become 0x3F44 Quick View Information (ctrl + Q) Wav file
script:text hexdump (readfile(, "b",50, ,1),,"b"),1,); Look at the location of 18h, 0xAC44 or become 0x3F44 Quick View Information (ctrl + Q) Wav file
To see the attached files, you need to log into the forum.
-
admin
- Site Admin
- Posts: 67271
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Readfile command to read binary file error!
You should use the new "r" mode (r = raw bytes, binary safe, no conversion):
Code: Select all
text hexdump(readfile( , "r", 50), , "b"); //you see the true bytesFAQ | XY News RSS | XY X
-
youtao6256
- Posts: 20
- Joined: 21 Aug 2017 06:45
Re: Readfile command to read binary file error!
Thank you very much for your help, this is indeed the case, I hope you can update the script command help, there are only "t" and "b" mode.
But I used the writefile command encountered problems, trouble to help me see where I use the wrong!
script:writefile("test-out.txt", readfile(, "r"),,"r");
File size and data are problematic! script:writefile("test-out.txt", readfile(, "r"),,"b");
File size and data are problematic!
script:writefile("test-out.txt", readfile(, "r"),,"r");
File size and data are problematic! script:writefile("test-out.txt", readfile(, "r"),,"b");
File size and data are problematic!
To see the attached files, you need to log into the forum.
-
admin
- Site Admin
- Posts: 67271
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Readfile command to read binary file error!
You are right, the fix was not complete. Next version should have it all. Then you can do either of these:
The help file us updated with each bigger release.
Code: Select all
writefile("test-out.txt", readfile(, "r"), , "r");Code: Select all
writefile("test-out.txt", readfile(, "ru"), , "ru");FAQ | XY News RSS | XY X
XYplorer Beta Club