Welcome to %s forums

BrainModular Users Forum

Login Register

strtoint() and sysex

General Discussion about whatever fits..
Post Reply
ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 25 Mar 2014, 19:17

I'm working on getting text input to display on the Push LCD. I was hoping it would be easy, but I've already hit a bit of a wall:

Code: Select all

        k := strtoint('s');
        writeln('s is '+inttostr( k ));
That results in an error: Error : ''s'' is not a valid integer value

How can I get back the ASCII integer value of 's' ?

sorry, this got posted to general discussion but it should be in patching questions.

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 25 Mar 2014, 21:49

Code: Select all

var k: integer;
begin
 k := ord('s');
 itrace(k);
end;
this should do the trick?

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 26 Mar 2014, 12:14

Yes, that should work! I will give it a try as soon as possible and let you know.

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 30 Mar 2014, 16:43

Code: Select all

      for l:=0 to Length(string1)
      do begin
        c :=  copy(string1, l, 1); 
        k := ord( c );
The above code throws an 'Invalid cast' compile time error.

1) k is defined as an integer as in the first example.
2) c was first a char, but the StrGet function seems not to be defined so I switched c to a string and used copy with a length of 1.

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 30 Mar 2014, 17:24

Code: Select all

      for l:=0 to Length(string1)
      do begin
        c :=  string1[l];
        lcd[0][l] := ord( c );
Switching 'c' back to type char and and accessing the string as an array worked.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 73 guests