What are stringconstants good for?

General discussion on mikroBasic PRO for 8051.
Post Reply
Author
Message
Thomas.Pahl@t-online.de
Posts: 158
Joined: 24 May 2008 15:55
Location: Germany

What are stringconstants good for?

#1 Post by Thomas.Pahl@t-online.de » 28 Sep 2008 11:05

Tried to do this simple thing:

const TESTR = "Hello World"
dim msg1 as string[20]
msg1 = TESTR

doen't work!


const TESTR as char[11] = (72,69,76,76,79,32,87,79,82,76,68,0)
dim msg1 as string[20]
msg1 = TESTR

works!!!?

Thopas

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#2 Post by yo2lio » 28 Sep 2008 11:30

Hello,

Works, very good, but you must define type of constant ...

Code: Select all

const TESTR as string[11] = "Hello World"

dim msg1 as string[20]

msg1 = TESTR 
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Thomas.Pahl@t-online.de
Posts: 158
Joined: 24 May 2008 15:55
Location: Germany

#3 Post by Thomas.Pahl@t-online.de » 28 Sep 2008 13:30

yes that works! But help says: compiler will asume automatically string as in my version.(In former compiler version (avr,dspic) it worked that way too!
It seems that there are some changes.

Post Reply

Return to “mikroBasic PRO for 8051 General”