[a119] How to rawRead ? Topic is solved

Get help for the alpha version of AutoHotkey v2 here. Please state the v2 version you are working with in the title when making a new topic.
User avatar
FredOoo
Posts: 118
Joined: 07 May 2019, 21:58
Location: Paris

[a119] How to rawRead ?

16 Aug 2020, 08:18

Isn't it the right way to do ?

Code: Select all

	MyFile := fileOpen( fileName, "r" )
	MyFile.pos := 0
	BUFFER := bufferAlloc( 3 )
	MyFile.rawRead( BUFFER, 3 )  ; Error: Parameter #1 invalid
It works with [a103]
Same problem with just downloaded [a122]
(Alan Turing) « What would be the point of saying that A = B if it was really the same thing? »
(Albert Camus) « Misnaming things is to add to the misfortunes of the world. »
swagfag
Posts: 4141
Joined: 11 Jan 2017, 17:59

Re: [a119] How to rawRead ?  Topic is solved

16 Aug 2020, 09:55

i dont see a problem with this code(a122)
User avatar
FredOoo
Posts: 118
Joined: 07 May 2019, 21:58
Location: Paris

Re: [a119] How to rawRead ?

16 Aug 2020, 10:28

Ok, now it works. But it's hard to transcribe v2 a103 to a122.
I got a file compatible v1 and v2 (a103) like this :

Code: Select all

	ver := subStr( a_AhkVersion, 1, 1 )
	if ver==1
		BUFFER := VarSetCapacity(BUFFER, 3)
	else
		BUFFER := bufferAlloc(3)

	;  …/…
	
	bufferAlloc(p*){
		; Because the function doesn't exist in AHK v1.
	}
With a103, the redefinition of bufferAlloc didn't erase the original one. But with a122, it does.
Thanks swagfag, and keep cool ;-)
(Alan Turing) « What would be the point of saying that A = B if it was really the same thing? »
(Albert Camus) « Misnaming things is to add to the misfortunes of the world. »

Return to “AutoHotkey v2 Help”

Who is online

Users browsing this forum: No registered users and 3 guests