Strings

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
levitan
Newbie
Posts: 1
Joined: Tue Mar 23, 2010 8:44 pm

Strings

Post by levitan »

How do i import a 2000 character text file as a single string in QBasic? I am trying to use
OPEN "a.txt" For Input as #1
INPUT #1, a$
but it appends it to about 500 characters.

Any help is much appreciated.
angros47
Veteran
Posts: 79
Joined: Mon Sep 08, 2008 12:52 pm
Contact:

Post by angros47 »

Use input$
User avatar
coma8coma1
Veteran
Posts: 100
Joined: Sat Dec 08, 2007 5:29 pm
Location: Maryland, USA

Post by coma8coma1 »

angros47 wrote:Use input$
hmm i've never used input$ before...

but i found this http://www.qb64.net/wiki/index.php?titl ... statement) and it seems simple enough. you can read a specific number of bytes at a time.

-,8
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Try this link to use INPUT$(bytes%, filenumber%):

http://www.qb64.net/wiki/index.php?title=INPUT$
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Post Reply