Share your opinion
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
|
work with files - Use Text files
USE TEXT FILES
hye, today, we use a text file with summary command such as Open, close, copy, paste, etc... OPEN A TEXT FILE Open a file in gambas is simple Define 2 variables : Myfile AS File Myline AS String now, you open the file and make a end of file test with loop :
Here the complete code:
In this example, we send all string to the terminal console using PRINT instruction. we could send string in a textarea by the command :
CLOSE A FILE Don't forget to close the file by the command :
Tips : It not necessary to close your file in gb but if you 're a great coder, you do it :) SEARCH STRING To search string, use the lnStr command who search in a string and return the position. example : numero = Instr(maligne , "toto") It means in the string maligne, search the string "toto" and put the position in toto variable if the maligne string is : "bonjour toto tu vas bien?", numerowill be : 9 COUNT LINE IN A FILE Insert in the WHILE NOT WEND boucle a "numeroligne" integer variable and increment it when you feed back the bouclewith INC command :
Have a good day ! Creation date : 03/10/2009 @ 16:25 Reactions to this article
| QUICK MENU
SEARCH
LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS
visitors visitors online ARCHIVES GAMBAS 1/2
|