346
Programmazione (Gambas 2) / Re: MyBot in Internet
« il: 24 Febbraio 2010, 17:12:12 »
si, con il php il ragionamento è molto simile.
19/05/2023: A causa di un errore sono stati cancellati, insieme ad account creati da bot, alcuni account legittimi. Si prega di leggere qui: https://www.gambas-it.org/smf/index.php?topic=9733.0
Questa sezione ti permette di visualizzare tutti i post inviati da questo utente. N.B: puoi vedere solo i post relativi alle aree dove hai l'accesso.
PUBLIC SUB carica_Click()
DIM hFile AS File
DIM a1 AS Integer
DIM b1 AS Integer
DIM sOneLine AS String
hFile = OPEN User.home &/ "testo.txt" FOR INPUT
a1 = 1
b1 = 1
WHILE NOT Eof(hFile)
LINE INPUT #hFile, sOneLine
matr[a1, b1] = sOneLine
a1 = a1 + 1
IF a1 = 9 THEN
a1 = 1
b1 = b1 + 1
ENDIF
IF b1 = 9 THEN
b1 = 1
ENDIF
WEND
CLOSE #hfile
END
x
y
t
f
Perchè i cicli for iniziano da 1? Prova a farli partire da 0 e farli arrivare a 7 invece che 8....Gli faccio partire da 1 perché la matrice di 0 è vuota, comunque ho fatto da 0 a 7 e ho aggiunto 1
In più devi prelevarti i dati per la matrici con due cicli for così come gli hai inseriti..fatto, ma non va lo stesso
PUBLIC SUB carica_Click()
DIM hFile AS File
DIM Stringa2 AS String
DIM a1 AS Integer
DIM b1 AS Integer
hFile = OPEN User.home &/ "testo.txt" FOR INPUT
FOR a1 = 0 TO 7
FOR b1 = 0 TO 7
stringa2 = hfile.Load(User.home &/ "testo.txt")
NEXT
NEXT
matr = Split(stringa2, "\n", "", TRUE)
CLOSE #hfile
END
PUBLIC SUB salva_Click()
DIM hFile AS File
DIM stringa2 AS String
DIM a1 AS Integer
DIM b1 AS Integer
FOR a1 = 1 TO 8
FOR b1 = 1 TO 8
stringa2 = stringa2 & matr[a1, b1] & "\n"
NEXT
NEXT
hFile = OPEN User.home &/ "testo.txt" FOR CREATE
hfile.save(User.home &/ "testo.txt", stringa2)
CLOSE #hFile
END
PUBLIC SUB carica_Click()
DIM hFile AS File
DIM Stringa2 AS String
hFile = OPEN User.home &/ "testo.txt" FOR INPUT
stringa2 = hfile.Load(User.home &/ "testo.txt")
matr = Split(stringa2, "\n", "", TRUE)
CLOSE #hfile
END