forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Please help with VDS6 file I/O

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
bornsoft
Contributor
Contributor


Joined: 19 Feb 2009
Posts: 113
Location: Germany

PostPosted: Wed Nov 18, 2009 2:59 pm    Post subject: Please help with VDS6 file I/O Reply with quote

hi,

i'm trying to get by with binary file-copy.
i found an example for VDS5 and because "@read()" and "write" should be the replacement for "@binfile()" and "binfile", i tried the same way.

But it seems, that with VDS6 you can only write 1 byte at a time (and this first has to be rid of the trailing fieldsep). that differs from what i interpret the helpfile.

"@read()" returns binary data separated by fieldseps while "write" cannot handle these characters and stops with "non numeric" error.

I don't know if it's a bug in the write command or if i'm wrong. Could you help me please?

Here ist a VDS5 code-snippet from this post (see SnarlingSheeps answer):

http://forum.vdsworld.com/viewtopic.php?t=2268&highlight=hex+binary

Code:


  BINFILE OPEN,1,%%InFile,READ
  BINFILE OPEN,2,%%OutFile,CREATE
  REPEAT
    BINFILE SEEK,1,%%Pos
    BINFILE SEEK,2,%%Pos
    %%Read = @BINFILE(READ,1,BINARY,%%Bytes)
    BINFILE WRITE,2,BINARY,%%Read
    %%Pos = @FADD(%%Pos,%%Bytes)
  UNTIL @BINFILE(EOF,1)
  BINFILE CLOSE,1
  BINFILE CLOSE,2



And here is what i'm trying to do with VDS6:

Code:


  %I = @new(file,<InputFile>,read)
  %O = @new(file,<OutputFile>,create)
  %z = 0
  repeat
    seekfile %I,%z
    %x = @read(%I,32,binary)
    if %x
      write %O,%x,binary
    end
    %z = @succ(%z)
  until @filepos(%I,eof)
  closefile %I
  closefile %O



Hmmm, strange - If i omit both "binary", it works, but for a 200kB input-file i get a 1599kB output.

It's a pity that this behaviour doesn't apply to my money Wink


Thanks in advance.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group