Page 1 of 1

Read String Problem with PB 4.4 and 4.3 (not 4.2)

Posted: Sat Dec 26, 2009 9:27 pm
by heinz.goldbach
Hello,
i have a little Problem with PB 4.4 and 4.3
When i compile the code i have got the error message:
Read can´t convert automaticly a number into a string
when i compile the same source with PB 4.2 there is no problem.
I cant find the bug.
I hope someone can help me.

here is a little bit code to see the problem.
Global Dim Block1.s(2,5)

Gosub ArraysFuellen
ExamineDesktops()

DataSection
AllgemeineFischkunde:
Data.s "Welche Aufgaben erfüllen Rücken- und Afterflossen heimischer Fische?"
Data.s "a) Sie dienen der Fortbewegung"
Data.s "b) Sie dienen der Steuerung"
Data.s "c) Sie dienen als Stabilisatoren"
Data.s "3"

Data.s "An welchen Teilen des Fischkörpers kann man das ungefähre Alter des Fisches feststellen?"
Data.s "a) An der Stärke der Haut und an der Anzahl der Flossenstrahlen"
Data.s "b) An der Anzahl und Länge der Kiemendorne"
Data.s "c) An den Schuppen und den Kiemendeckeln"
Data.s "3"
EndDataSection

End


ArraysFuellen:
Restore AllgemeineFischkunde:
For x= 1 To 2
For y= 1 To 5
Read (Block1.s(x,y))
Next y
Next x
Return

Re: Read String Problem with PB 4.4 and 4.3 (not 4.2)

Posted: Sat Dec 26, 2009 9:40 pm
by ts-soft

Code: Select all

Global Dim Block1.s(2, 5)

Gosub ArraysFuellen
ExamineDesktops()

DataSection
  AllgemeineFischkunde:
  Data.s "Welche Aufgaben erfüllen Rücken- und Afterflossen heimischer Fische?"
  Data.s "a) Sie dienen der Fortbewegung"
  Data.s "b) Sie dienen der Steuerung"
  Data.s "c) Sie dienen als Stabilisatoren"
  Data.s "3"

  Data.s "An welchen Teilen des Fischkörpers kann man das ungefähre Alter des Fisches feststellen?"
  Data.s "a) An der Stärke der Haut und an der Anzahl der Flossenstrahlen"
  Data.s "b) An der Anzahl und Länge der Kiemendorne"
  Data.s "c) An den Schuppen und den Kiemendeckeln"
  Data.s "3"
EndDataSection

End


ArraysFuellen:
Restore AllgemeineFischkunde:
For x = 1 To 2
  For y = 1 To 5
    Read.s Block1.s(x, y)
  Next y
Next x
Return
read the changing in history of PB 4.30

greetings
Thomas

Re: Read String Problem with PB 4.4 and 4.3 (not 4.2)

Posted: Sat Dec 26, 2009 9:55 pm
by heinz.goldbach
It works

Thank you

Re: Read String Problem with PB 4.4 and 4.3 (not 4.2)

Posted: Fri Jan 01, 2010 6:23 pm
by trevorlawrence
Advertising Spam removed by berikco

Re: Read String Problem with PB 4.4 and 4.3 (not 4.2)

Posted: Fri Jan 01, 2010 6:51 pm
by netmaestro
Welcome to the forums! Firstly, if you have a question about coding, start a new thread on the Coding Questions board. Secondly, post your try in PureBasic code so people can tell you what if anything is wrong with it. You'll get lots of help in short order, believe me.

Re: Read String Problem with PB 4.4 and 4.3 (not 4.2)

Posted: Fri Jan 01, 2010 10:02 pm
by Demivec
trevorlawrence wrote:Hi All,

First of all I apologise if this is not the relevant place to post my query. I have a query on string problem and that is the reason I am posting here.

I have the following code:

const
Sizes:array[0..10] of string=('Junior,Small,Medium,Large',
'Junior,Adult','Junior,Adult','Junior,Adult');

apparently my number of elements differs from my declaration. can anyone help me by telling me how many elements i have and what i should put in my declaration? i thought i had it right... :(
Your code is not PureBasic, is it? That is the first problem. There are several others. Look in the manual under 'General Syntax Rules' regarding constants, and also the topics listed under 'Arrays, Lists, & Structures'. One additional note, you can't define an array constant but there are workarounds that can be used (which is best would depend on your specific needs).

If you need specific help post a question in the Coding Questions forum as suggested by netmaestro.