Bonjour Paolo Mantovani
Message du 2006-06-19 02:23:
oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess")
oFile = oUcb.OpenFileReadWrite("file:///home/paolo/img.png")
oInputStream = createUnoService("com.sun.star.io.DataInputStream")
oInputStream.setInputStream(oFile.getInputStream())
' print oFile.getLenght 'error!!!
' oFile.seek(5) 'error!!!
oFile.seek(CreateUnoValue("hyper", 5)) 'No problem......

oInputStream.closeInput


I found a solution to this example. Tested on a 50Mbytes file.

dim oUcb as object, oFile as object, oInputStream as object
dim hx as variant, hxb as variant, p as variant

oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess")
oFile = oUcb.OpenFileReadWrite(convertToURL("D:\Music\Haendel235.wav"))
oInputStream = createUnoService("com.sun.star.io.DataInputStream")
oInputStream.setInputStream(oFile.getInputStream())
hx = oFile.getLength
hxb = CLng(hx)  ' convert to a usable Basic type
print hxb
hxb = hxb -4879123  ' compute a related position
print hxb
oFile.seek(CreateUnoValue("hyper", hxb)
p = oFile.getPosition
print CLng(p)  ' confirmation
oInputStream.closeInput


   Bernard

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to