Apache OpenOffice (AOO) Bugzilla – Issue 59197
Get function unexplained behaviour
Last modified: 2017-05-20 11:27:44 UTC
following exemple (from on line help) doen't work as expected: What happens is Get function always position at file end, whatever seek does before. It is only when position is put in the get call that get works. Sub ExampleRandomAccess Dim iNumber As Integer Dim sText As String * 32'REM Must be une variant 'WRONG variant generates error Dim aFile As String aFile = "c:\data.txt" iNumber = Freefile Open aFile For Random As #iNumber Len=32 Seek #iNumber,1 REM Position au début Put #iNumber,, "Ceci est la première ligne de texte." REM Remplir la ligne avec du texte Put #iNumber,, "Ceci est la seconde ligne de texte." Put #iNumber,, "Ceci est la troisième ligne de texte." Seek #iNumber,1 Get #iNumber,,sText Get #iNumber,,sText Get #iNumber,,sText Print sText Close #iNumber end sub
sw->ab: from the looks of it the method "get" indeed always tries to get from the end of the file, until it is called with a position. Also right is that the sample in the help throws an exception if "Dim sText As Variant" isn't changed to "Dim sText As String".
I have seen your comment, but with a string as recipient variable I was unable to get anything (ie the seek doesn't change the get return value=""), whereas with a long or any other limited length variable, get works. In vb, a delimited length string (eg as sting * 8 or so) is necessary. Up to now I get to an integer variable from which I retrieve the char, but that is not elegant...
Started, OOo Later for now...
Reset assigne to the default "issues@openoffice.apache.org".