Readfile command to read binary file error!
-
- 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
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:
One of my scripts helped you out? Please donate via Paypal
-
- Posts: 20
- Joined: 21 Aug 2017 06:45
Re: Readfile command to read binary file error!
my system is win7,64 bit
-
- Site Admin
- Posts: 60597
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @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: No
FAQ | XY News RSS | XY Twitter
-
- 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.
-
- 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.
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
-
- 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)
-
- Site Admin
- Posts: 60597
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Readfile command to read binary file error!
Thanks. Fix comes with next beta version.
FAQ | XY News RSS | XY Twitter
-
- 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
-
- Site Admin
- Posts: 60597
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @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 bytes
FAQ | XY News RSS | XY Twitter
-
- 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.
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!
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!
-
- Site Admin
- Posts: 60597
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @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 Twitter