2016-09-19 1 views
1

Je commence juste avec la gestion de fichiers dans qbasic. Le programme que j'ai écrit montre toujours une erreur "mauvais mode de fichier". Aidez-moi, s'il vous plaît!erreur "mode de fichier incorrect" dans qbasic

OPEN "test.dat" FOR INPUT AS #1 
CLS 
INPUT "Enter username:"; a$ 
INPUT "Enter Password:"; b$ 
WRITE #1, a$, b$ 
CLOSE #1 
END 
+0

Les fichiers dans qbasic peuvent être ouverts pour input/output/append/binary/random. – eoredson

+0

Ce lien décrit l'accès aux fichiers dans qb64 http://www.qb64.net/wiki/index.php/OPEN – eoredson

Répondre

3

Si vous souhaitez WRITE sortie vers un fichier puis, logiquement, vous voudrez peut-être essayer ceci:

OPEN "test.dat" FOR OUTPUT AS #1 
CLS 
'etc 
+1

Je suis un imbécile. – uvrichest

+0

Non, commence juste .. – eoredson

1

Un échantillon d'accès aux fichiers plus descriptif Qbasic:

' input data and write to file: 
OPEN "test.dat" FOR OUTPUT AS #1 
INPUT "Enter Username:"; a$ 
INPUT "Enter Password:"; b$ 
WRITE #1, a$, b$ 
CLOSE #1 
' open file for input and display data: 
OPEN "test.dat" FOR INPUT AS #1 
INPUT #1, a$, b$ 
PRINT "Username: "; a$ 
PRINT "Password: "; b$ 
CLOSE #1 
END 
+0

Notez que l'écriture est associée à l'entrée, tandis que l'impression est associée à l'entrée de ligne pour l'accès au fichier. – eoredson