Issue 61280 - Basic Get and Put without position do not use pointer which was set by Seek
Summary: Basic Get and Put without position do not use pointer which was set by Seek
Status: CLOSED FIXED
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows XP
: P3 Trivial
Target Milestone: 4.2.0
Assignee: ab
QA Contact:
URL:
Keywords:
Depends on:
Blocks: 61728
  Show dependency tree
 
Reported: 2006-01-29 00:54 UTC by Regina Henschel
Modified: 2016-07-21 18:34 UTC (History)
2 users (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 Regina Henschel 2006-01-29 00:54:51 UTC
On a file opened with Random access Get and Put without position always work at
end of file and do not use the pointer position which was set with the
seek-statement.

To see this error use the following macros:
(1)
Sub Main
Dim iNumber As Integer
Dim aFile As String
Dim wert As string
aFile = "c:\daten.txt"
iNumber = Freefile
Open aFile For Random As #iNumber len=10
Put #iNumber, ,"AAAAAA"
Put #iNumber, ,"BBBBBB"
Put #iNumber, ,"CCCCCC"
Put #iNumber, ,"DDDDDD"
Put #iNumber, ,"EEEEEE"
Put #iNumber, ,"FFFFFF"
seek #iNumber,4
msgBox "loc()=" & loc(#iNumber)& " seek()=" & seek(#iNumber)
get #iNumber, ,wert
msgBox "wert=" & wert
msgBox "loc()=" & loc(#iNumber)& " seek()=" & seek(#iNumber)
Close #iNumber
End Sub

Then delete Seek-statement and use
    Get #iNumber,4,wert
instead of
    Get #iNumber, ,wert
Now you get the right record.

(2)
Sub Main
Dim iNumber As Integer
Dim aFile As String
Dim wert As string
aFile = "c:\data.txt"
iNumber = Freefile
Open aFile For Random As #iNumber len=10
Put #iNumber,1,"AAAAAA"
Put #iNumber,2,"BBBBBB"
Put #iNumber,3,"CCCCCC"
Put #iNumber,4,"DDDDDD"
Put #iNumber,5,"EEEEEE"
Put #iNumber,6,"FFFFFF"
seek #iNumber,4
put #iNumber,,"XXXXXX"
get #iNumber,4,wert
msgBox "wert 4=" & wert
get #iNumber,7,wert
msgBox "wert 7=" & wert
Close #iNumber
End Sub

Then delete Seek-statement and use
   Put #iNumber,4,"XXXXXX"
instead of
   Put #iNumber,,"XXXXXX"
Now it writes the data to the desired position.
Comment 1 Olaf Felka 2006-01-30 09:13:34 UTC
@ jsk: Please have a look.
Comment 2 joerg.skottke 2006-04-25 12:16:39 UTC
to ab, target 2.0.4 / p3
Comment 3 ab 2006-05-15 14:10:50 UTC
-> OOo 2.x, started
Comment 4 Mathias_Bauer 2007-12-04 14:57:33 UTC
basic and scripting issues now should be assigned to component "scripting"
Comment 5 Martin Hollmichel 2007-12-07 12:13:33 UTC
set target to 3.x according to http://wiki.services.openoffice.org/wiki/Target_3x
Comment 6 damjan 2016-07-21 13:14:17 UTC
Can't reproduce either of these any more, on Windows 8 or 32 bit Ubuntu Linux 14.04. Probably fixed by the new(ish) _USE_UNO file I/O that we use now instead. Resolving fixed.