Search found 20 matches
- Tue Jun 02, 2015 7:39 pm
- Forum: Coding Questions
- Topic: Quick Question: How to turn off the Keys in PureBasic?
- Replies: 0
- Views: 1125
Quick Question: How to turn off the Keys in PureBasic?
Does PureBasic has a command to turn off the Keys? Thanks.
- Fri May 29, 2015 3:11 am
- Forum: Coding Questions
- Topic: How does PureBasic parse files?
- Replies: 45
- Views: 12360
Re: How does PureBasic parse files?
[quote="Marc56us"]Hi :P
id = Asc( Left(TmpLine$, 1) ) ; ASCII value of first char of line
i + 1 ; increment i (can be write as i = i + 1)
Select id
Case 34
; Double-quote
Debug "Line " + Str(i) + " is Part 1 : " + TmpLine$
; Trim (string, chr(34) while remove "" at beging and end ...
id = Asc( Left(TmpLine$, 1) ) ; ASCII value of first char of line
i + 1 ; increment i (can be write as i = i + 1)
Select id
Case 34
; Double-quote
Debug "Line " + Str(i) + " is Part 1 : " + TmpLine$
; Trim (string, chr(34) while remove "" at beging and end ...
- Fri May 29, 2015 2:58 am
- Forum: Coding Questions
- Topic: How does PureBasic parse files?
- Replies: 45
- Views: 12360
Re: How does PureBasic parse files?
Hi mao This parses the file as you have described and prints the results to the debug window. Its based on parsing the file till the separator is reached, whereby the sep variable is set to 1 and now all subsequent reads are placed in the numbers linkedlist of which is of type string so can be ...
- Fri May 29, 2015 2:32 am
- Forum: Coding Questions
- Topic: How does PureBasic parse files?
- Replies: 45
- Views: 12360
Re: How does PureBasic parse files?
Hi mao
Looks like we are going to struggle to pull you out of Quick Basic mode :mrgreen:
For example, why hard-code a file path? Why read the file multiple times? I think perhaps the answer is - what your app does next. What we need then is the whole picture, we need to know what the goal of ...
Looks like we are going to struggle to pull you out of Quick Basic mode :mrgreen:
For example, why hard-code a file path? Why read the file multiple times? I think perhaps the answer is - what your app does next. What we need then is the whole picture, we need to know what the goal of ...
- Thu May 28, 2015 6:53 pm
- Forum: Coding Questions
- Topic: How does PureBasic parse files?
- Replies: 45
- Views: 12360
Re: How does PureBasic parse files?
Didn't know that....Tenaja wrote:mao, please wrap code snips within the code brackets. There is a button just above the forum message editor to simplify it.

Thanks
- Thu May 28, 2015 4:55 pm
- Forum: Coding Questions
- Topic: quick question: how to set the length of a float variable
- Replies: 6
- Views: 2521
Re: quick question: how to set the length of a float variabl
Marc56us wrote:You can't store float with a specific number of decimal digits
This is why some software store smalls numeric values as string and convert it as number only if calculation is need
Thanks! I may keep the full length of it
- Thu May 28, 2015 4:52 pm
- Forum: Coding Questions
- Topic: How does PureBasic parse files?
- Replies: 45
- Views: 12360
Re: How does PureBasic parse files?
OpenFile(1,"example.TXT")
n = 0
While Eof(1) = 0
String.s = ReadString(1)
If FindString(String, ",")
n = n + 1
EndIf
Wend
CloseFile(1)
Dim otu.s(n-1)
Dim otu2.s(n-1)
OpenFile(1,"example.TXT")
n = 0
While Eof(1) = 0
String.s = ReadString(1)
If FindString(String, ",")
cp = FindString ...
n = 0
While Eof(1) = 0
String.s = ReadString(1)
If FindString(String, ",")
n = n + 1
EndIf
Wend
CloseFile(1)
Dim otu.s(n-1)
Dim otu2.s(n-1)
OpenFile(1,"example.TXT")
n = 0
While Eof(1) = 0
String.s = ReadString(1)
If FindString(String, ",")
cp = FindString ...
- Thu May 28, 2015 4:40 pm
- Forum: Coding Questions
- Topic: How does PureBasic parse files?
- Replies: 45
- Views: 12360
Re: How does PureBasic parse files?
original PB code
Hi mao
I think that's the original Quick Basic code........ :D
I see no point in trying to mimic the QB code in PB, even though it clearly can be done.
I note that my example code parses your 2nd data sample well (it does not expect an empty line!), which itself is an argument ...
Hi mao
I think that's the original Quick Basic code........ :D
I see no point in trying to mimic the QB code in PB, even though it clearly can be done.
I note that my example code parses your 2nd data sample well (it does not expect an empty line!), which itself is an argument ...
- Thu May 28, 2015 4:27 pm
- Forum: Coding Questions
- Topic: quick question: how to set the length of a float variable
- Replies: 6
- Views: 2521
Re: quick question: how to set the length of a float variabl
I assume that you want to cut it to 4-5 decimal places when you display it to the user?
If so, you can use:
Result$ = StrF(Value.f [, NbDecimal])
e.g.:
string.s = "0.99999"
Debug ValF(string)
Debug StrF(ValF(string) ,5)
Hi Julian! StrF does cut the string to specific length, but now we get ...
If so, you can use:
Result$ = StrF(Value.f [, NbDecimal])
e.g.:
string.s = "0.99999"
Debug ValF(string)
Debug StrF(ValF(string) ,5)
Hi Julian! StrF does cut the string to specific length, but now we get ...
- Thu May 28, 2015 3:47 pm
- Forum: Coding Questions
- Topic: quick question: how to set the length of a float variable
- Replies: 6
- Views: 2521
quick question: how to set the length of a float variable
how to set the length of a float variable?
I try to save a string(with a numeric value) into a float type, but have no idea how to set the limitation of the length of float variable.
for example:
string.s = "0.99999"
debug ValF(string)
which returns 32bit, but I only need 4 or 5 digits after the ...
I try to save a string(with a numeric value) into a float type, but have no idea how to set the limitation of the length of float variable.
for example:
string.s = "0.99999"
debug ValF(string)
which returns 32bit, but I only need 4 or 5 digits after the ...
- Thu May 28, 2015 1:50 pm
- Forum: Coding Questions
- Topic: How does PureBasic parse files?
- Replies: 45
- Views: 12360
Re: How does PureBasic parse files?
original PB code
n = 76
DIM dm(n, n)
DIM array1$(n)
DIM array2$(n)
OPEN "..\example.txt" FOR INPUT AS #1
DO
INPUT #1, z$
LOOP UNTIL z$ = ""
n = 0
DO
n = n + 1
INPUT #1, array1$(n)
IF array1$(n) = "" THEN EXIT DO
INPUT #1, array2$(n)
LOOP
notu = n - 1
FOR i = 1 TO notu - 1
FOR j = i + 1 TO ...
n = 76
DIM dm(n, n)
DIM array1$(n)
DIM array2$(n)
OPEN "..\example.txt" FOR INPUT AS #1
DO
INPUT #1, z$
LOOP UNTIL z$ = ""
n = 0
DO
n = n + 1
INPUT #1, array1$(n)
IF array1$(n) = "" THEN EXIT DO
INPUT #1, array2$(n)
LOOP
notu = n - 1
FOR i = 1 TO notu - 1
FOR j = i + 1 TO ...
- Thu May 28, 2015 1:44 pm
- Forum: Coding Questions
- Topic: How does PureBasic parse files?
- Replies: 45
- Views: 12360
Re: How does PureBasic parse files?
"Haemophilus"," Oral Taxon 535"
"Aggregatibacter"," sp. Oral Taxon 513 clone"
"Haemophilus"," sp. Oral Taxon 036 clone "
"Haemophilus"," sp. Oral Taxon 035 clone "
"Aggregatibacter"," Oral Taxon 720 "
"Haemophilus haemolyticus","Oral Taxon 851 "
"Haemophilus ducreyi"," Oral Taxon 821 ...
"Aggregatibacter"," sp. Oral Taxon 513 clone"
"Haemophilus"," sp. Oral Taxon 036 clone "
"Haemophilus"," sp. Oral Taxon 035 clone "
"Aggregatibacter"," Oral Taxon 720 "
"Haemophilus haemolyticus","Oral Taxon 851 "
"Haemophilus ducreyi"," Oral Taxon 821 ...
- Thu May 28, 2015 1:43 pm
- Forum: Coding Questions
- Topic: How does PureBasic parse files?
- Replies: 45
- Views: 12360
Re: How does PureBasic parse files?
"Haemophilus"," Oral Taxon 535"
"Aggregatibacter"," sp. Oral Taxon 513 clone"
"Haemophilus"," sp. Oral Taxon 036 clone "
"Haemophilus"," sp. Oral Taxon 035 clone "
"Aggregatibacter"," Oral Taxon 720 "
"Haemophilus haemolyticus","Oral Taxon 851 "
"Haemophilus ducreyi"," Oral Taxon 821 ...
"Aggregatibacter"," sp. Oral Taxon 513 clone"
"Haemophilus"," sp. Oral Taxon 036 clone "
"Haemophilus"," sp. Oral Taxon 035 clone "
"Aggregatibacter"," Oral Taxon 720 "
"Haemophilus haemolyticus","Oral Taxon 851 "
"Haemophilus ducreyi"," Oral Taxon 821 ...
- Thu May 28, 2015 2:46 am
- Forum: Coding Questions
- Topic: How does PureBasic parse files?
- Replies: 45
- Views: 12360
Re: How does PureBasic parse files?
Hello Mao
If you study everybody's examples, the parsing is done with very little code. All the extra lines of code are there to:
1) Make the code safe/durable for use with different files;
2) Define a Window to display the Results;
3) Allow any amount of files to be opened and the results ...
If you study everybody's examples, the parsing is done with very little code. All the extra lines of code are there to:
1) Make the code safe/durable for use with different files;
2) Define a Window to display the Results;
3) Allow any amount of files to be opened and the results ...
- Wed May 27, 2015 8:40 pm
- Forum: Coding Questions
- Topic: How does PureBasic parse files?
- Replies: 45
- Views: 12360
Re: How does PureBasic parse files?
Thanks all!
I am just curious why it only takes 19 short-line code(two DO-LOOP and one FOR-NEXT loop) in QuickBasic to parse this file, but in PureBasic we have to write a much longer one. PureBasic is suposed to be more powerful than QB,right?
I am just curious why it only takes 19 short-line code(two DO-LOOP and one FOR-NEXT loop) in QuickBasic to parse this file, but in PureBasic we have to write a much longer one. PureBasic is suposed to be more powerful than QB,right?
