Issue 59197 - Get function unexplained behaviour
Summary: Get function unexplained behaviour
Status: ACCEPTED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows XP
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-11 10:23 UTC by pi_r2
Modified: 2017-05-20 11:27 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description pi_r2 2005-12-11 10:23:33 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
Comment 1 stephan.wunderlich 2005-12-13 09:07:30 UTC
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".
Comment 2 pi_r2 2005-12-13 18:34:57 UTC
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...
Comment 3 ab 2006-02-16 11:35:52 UTC
Started, OOo Later for now...
Comment 4 Marcus 2017-05-20 11:27:44 UTC
Reset assigne to the default "issues@openoffice.apache.org".