0

嗨,我是 VB6 的新手,我想实现这个:当用户登录时,他输入他的姓名和密码,我应该把它写在一个文件中。

这是文件“authentification.txt”:它有用户名密码的形式

   bill hope
   jessica 1234567 
   jhon 7654321

这是代码:

Open "c:\authentification.txt" For Binary As #1
x = txtidentifiant.Text
y = txtmotdepasse.Text
Do While Not EOF(1)
Line Input #1, l
If l <> " " Then 
Put 1, i, x & vbNewLine
Put 1, i + 1, y & vbNewLine

Else
//here i want to implement a  carriage return in the file #1
End If
Loop

我的问题是:如果文件像这样填充:bhope 并且它只写第一行

4

2 回答 2

2

您应该使用InputPrint语句。它们读取和写入逗号分隔的文件,并且设计为成对使用,仅用于此类应用程序。

于 2013-03-27T09:55:10.173 回答
0

这是新代码:

Open "c:\authentification.txt" For Append As #1
x = txtidentifiant.Text
y = txtmotdepasse.Text
Print #1, x
Print #1, y
Close #1
于 2013-03-27T10:30:56.233 回答