Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - TheGuardHQ

Pages: [1]
1
QB64 Discussion / VB-Function "CByte"
« on: February 26, 2020, 09:43:04 am »
Hi all!

I'm looking for something comparable to the function "CByte" from VB.
But actually I am concerned with writing a CRC calculation for the MODBUS protocol:

Quote
Public Function crc(Framestr As String) As Byte
Dim count As Integer
Dim dummy As Byte
Do While (count < Len(Framestr))
count = count + 1
dummy = Asc(Mid(Framestr, count)) * 2 And &HFF
crc = crc Xor CByte(Asc(Mid(Framestr, count)) Xor dummy)
Loop
End Function

Did someone else ever have the same prolem and have you already written a function?

2
QB64 Discussion / Re: EOF with INPUT/BINARY
« on: December 04, 2018, 09:15:29 am »
Thank you - that was the solution.

Christian

3
QB64 Discussion / EOF with INPUT/BINARY
« on: December 04, 2018, 02:40:43 am »
Hello everybody!

I have a question about EOF.

If I create a blank file and then read this with "INPUT", this works without error message:

OPEN "c:\temp\test.txt" FOR OUTPUT AS #1: CLOSE
OPEN "c:\temp\test.txt" FOR INPUT AS #1
DO WHILE NOT EOF(1)
    LINE INPUT #1, zeile$
LOOP
CLOSE #1


If I do the same thing with
  OPEN "c:\temp\test.txt" FOR BINARY AS #1
I get the error message "Input past end of file".

Can someone tell me how to write the DO-LOOP so I do not run into the EOF error?

Christian

4
QB64 Discussion / Re: File Read slow
« on: December 03, 2018, 10:05:24 am »
Many Thanks!

5
QB64 Discussion / Re: File Read slow
« on: December 03, 2018, 09:50:49 am »
Hi FellippeHeitor,

that really helped me a lot - THANKS!

The program now processes the 100,000 lines in 0.49 seconds.
That sounds good at first, but QB71 is still more than twice as fast.

In this small sample program that does not matter. But if I have to read a lot of files very often, you still notice the difference clearly.

Is there still a way to make it faster or is not there any more?

Christian

6
QB64 Discussion / File Read slow
« on: December 03, 2018, 09:02:55 am »
Hello everybody.

I have a question about the following sample code:

OPEN "c:\temp\kdb053.txt" FOR INPUT AS #1
t# = TIMER
WHILE NOT EOF(1)
    LINE INPUT #1, zeile$
WEND
PRINT TIMER - t#
CLOSE


The file "kdb053.txt" has about 100,000 lines.
When I start the program with QuickBasic 7.1, it takes 0.2 seconds.
QB64 takes over 16 seconds for the same program!

Does anyone have any idea where the problem is?

Thanks and good greeting
Christian

Pages: [1]