🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #1565

Re: QBASIC: Blok tegelijk van file lezen/schrijven

#1565
From: Dr.Ruud
Date: Fri, 04 Feb 2005 15:28
44 lines
2004 bytes
Toen ik Winterteen kietelde, kwam er dit uit:

> a$ = "": FOR b% = 1 TO 512: a$ = a$ + " ": NEXT
> b$ = a$
>
> OPEN "filelees" FOR BINARY AS #1  'Bestaande file
>         GET #1, , a$
>         GET #1, , b$
> CLOSE #1
>
> OPEN "fileschr" FOR BINARY AS #1  'Nieuwe file
>         PUT #1, , a$
>         PUT #1, , b$
> CLOSE #1

Variant:

  Dim blok AS String * 1024

  Open "filelees" For Binary AS #1

  Open "fileschr" For Output AS #2  ' truncate to 0 bytes
  Close #2
  Open "fileschr" For Binary AS #2

  Get #1, , blok
  Put #2, , blok

  Close #2
  Close #1

' Pas op: als de lengte van "filelees" minder dan 1024 bytes is,
' dan wordt "fileschr" toch 1024 bytes.

(ongetest)

QBasic-tutorial:
  http://www.programmersheaven.com/file/basic/QBASIC.ZIP

-- 
Affijn, Ruud   `  -  ?
               + ` ? *
                 ? `     Jvr qvg yrrfg,
               ?  =  `   fgresg wbatre.
Technical Details
Message-ID: <cu088h.18k.1@news.isolution.nl>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsgate.cistron.nl!transit.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
References: <4201616b$0$5557$58c7af7e@news.kabelfoon.nl> <4202bab4.10087501@News.Individual.NET> <42037c14$0$197$58c7af7e@news.kabelfoon.nl>

Show Full Headers
Complete Article Headers
X-Google-Thread: fcea4,40218b57011ce6fe
X-Google-Thread: 107324,40218b57011ce6fe
X-Google-Attributes: gidfcea4,gid107324,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsgate.cistron.nl!transit.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Message-ID: <cu088h.18k.1@news.isolution.nl>
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Newsgroups: be.comp.programming,nl.comp.programmeren
References: <4201616b$0$5557$58c7af7e@news.kabelfoon.nl> <4202bab4.10087501@News.Individual.NET> <42037c14$0$197$58c7af7e@news.kabelfoon.nl>
Subject: Re: QBASIC: Blok tegelijk van file lezen/schrijven
Date: Fri, 4 Feb 2005 16:28:57 +0100
Organization: Chaos rules.
X-Newsreader: WMDIYB
X-Archive-Me: please
Approved: yesterday
X-Face: &CQ$FIr!=+=w,8`0Q^Ug"1>F[(/op8->E;NQet`5fe$;=e*!Z5&REvp<~Tj|"Y[|8OcJ{w#z&mB7B:I)XO*%_|\]|YW$C>>$Q[9-#K~c$tQ^Mf0,wMo?h\C)TE>f
Lines: 46
NNTP-Posting-Host: 194.109.164.102
X-Trace: 1107531603 news.xs4all.nl 28977 [::ffff:194.109.164.102]:34730
X-Complaints-To: abuse@xs4all.nl