Hi, I'm trying to obtain a substring from a read line of a text file,
this is my code
but I cannot obtain the substring of r
where I'm wrong???
this is my code
B4X:
Menu.Show
Dim SVR,USR,PWD,DBN As String
'leggo dal file di testo i parametri per comporre la stringa di connessione al db remoto
If FileExist ("DBConnParam.txt") = True Then
Msgbox("File Parametri Connessione Trovato!",progname,cMsgboxYesNo,cMsgboxHand)
FileOpen (c1,"DBConnParam.txt",cRead ,, cASCII)
r = FileRead (c1)
Do Until r = EOF
Select r
Case SubString (""&r,1,3)= "SVR"
SVR = SubString (""&r,3,StrLength (r))
Msgbox (SVR)
Case SubString (""&r,0,3)= "USR"
USR = SubString (""&r,3,StrLength (r))
Msgbox (USR)
Case SubString (""&r,0,3)= "PWD"
PWD = SubString (""&r,3,StrLength (r))
Msgbox (PWD)
Case SubString (""&r,0,3)= "DBN"
DBN = SubString (""&r,3,StrLength (r))
Msgbox (DBN)
End Select
r = FileRead (c1)
Loop
FileClose (c1)
' sum = sum + r
' r = FileRead (c1)
' x = FileGet (c1, 3) 'x value will be of the third number stored in the file
' Msgbox(x,"My First Program",cMsgboxYesNo,cMsgboxHand)
'Loop
'FileClose (c1)
Else
Msgbox("File Parametri Connessione Non Trovato!",progname,cMsgboxYesNo,cMsgboxHand)
End If
End Sub
but I cannot obtain the substring of r
where I'm wrong???