text?
Hi spioner,
Not knowing English well is going to make reading the help file difficult, but you will need read it if you want to understand how PureBasic is used.
Maybe you can find a good online translator, or maybe French or German is easier for you?
Anyhow, I will try to help, others will as well.
The 0 is an identifier. PureBasic uses these to know which file you are dealing with. So, example:
This tells PureBasic to open two files identified as 0 and as 1.
It then tells PureBasic to write "abc" to file identified as 0 (text.txt) and "Wbc" to the file identified as 1 (text1.txt). So you can see that PureBasic needs the identifying number to know which file it is using when doing a file operation.
ReplaceString is a function. That means it returns a value, the result of the information (parameters) you sent it.
You can store the result in a variable:
or you can use the result directly:
Not being rude, just asking so we know your level and how to answer things:
Do you understand variables and literals?
Do you understand procedures (functions)?
Hope this is useful to you.
Not knowing English well is going to make reading the help file difficult, but you will need read it if you want to understand how PureBasic is used.
Maybe you can find a good online translator, or maybe French or German is easier for you?
Anyhow, I will try to help, others will as well.
The 0 is an identifier. PureBasic uses these to know which file you are dealing with. So, example:
Code: Select all
OpenFile(0, "C:\Text.txt")
OpenFile(1, "C:\Text1.txt")
WriteStringN(0, "abc")
WriteStringN(1, ReplaceString("abc","a","W"))
CloseFile(0)
CloseFile(1)
It then tells PureBasic to write "abc" to file identified as 0 (text.txt) and "Wbc" to the file identified as 1 (text1.txt). So you can see that PureBasic needs the identifying number to know which file it is using when doing a file operation.
ReplaceString is a function. That means it returns a value, the result of the information (parameters) you sent it.
You can store the result in a variable:
Code: Select all
OpenFile(0, "C:\Text.txt")
result$ = ReplaceString("abc","a","W")
WriteStringN(0, result$)
CloseFile(0)
Code: Select all
OpenFile(0, "C:\Text.txt")
WriteStringN(0, ReplaceString("abc","a","W"))
CloseFile(0)
Do you understand variables and literals?
Do you understand procedures (functions)?
Hope this is useful to you.
Dare2 cut down to size
Re: Again too most...
You forgot to actually read-in the data...
This only works if everything is in one line, else you have to go through
each line in order to make the changes. Just meant to give you an idea.
Code: Select all
; create a file and write some random text to it
OpenFile(0, "c:\test.txt")
For i=0 To 4200
WriteString(0, Chr(65+Random(55)))
Next
CloseFile(0)
; now, replace all occurences of 'x' with 'y' (case-insensitve)
OpenFile(0, "c:\test.txt")
tmp$ = ReplaceString(ReadString(0), "x", "y", 1)
FileSeek(0,0)
WriteString(0,tmp$)
CloseFile(0)
each line in order to make the changes. Just meant to give you an idea.
Good programmers don't comment their code. It was hard to write, should be hard to read.
Re: Again too most...
You're welcome
Good programmers don't comment their code. It was hard to write, should be hard to read.

Examples: http://www.purearea.net/
Information: http://www.xs4all.nl/~bluez/datatalk/purebasic.htm
Book - buy: http://www.pb-beginners.co.uk/
Dare2 cut down to size
Re: Thank you all. Now all work. Is it Much thanked all. Par
spioner wrote:Particularly note "traumatic".

didn't mean to be rude, never mind!

Good programmers don't comment their code. It was hard to write, should be hard to read.
Re: Again too most...
Here in the forum and a very good set of examples here:spioner wrote:PureBasic the best, but very laconic Help Files. Where I can find more references ? As well as where I can find much examples ?
http://www.purearea.net/pb/CodeArchiv/CodeArchiv.html
You need to download the archive of codes, its divided by categories. I recommend it to you.
Re: Maybe i false?
spioner, you didn't offend anyone, everything's ok, really!
Good programmers don't comment their code. It was hard to write, should be hard to read.
-
- Addict
- Posts: 1027
- Joined: Sun May 15, 2005 5:15 am
- Location: Australia
- Contact:
Re: Maybe i false?
вы поймете нас более лучше если мы пытаемся поговорить русского?spioner wrote: I am not very well English.
Demonio Ardente
Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!