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

Windows specific forum
heinz.goldbach
User
User
Posts: 25
Joined: Mon Dec 12, 2005 8:35 pm
Location: Neuss - Germany

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

Post 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
Intel i3, 8 GB RAM, 2*200 GB HDD, Windows 7 64bit
SUSE LINUX 10.1
Mac G4, OSX 10.4.11, 80 GB HDD, 1,5 GB RAM
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

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

Post 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
heinz.goldbach
User
User
Posts: 25
Joined: Mon Dec 12, 2005 8:35 pm
Location: Neuss - Germany

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

Post by heinz.goldbach »

It works

Thank you
Intel i3, 8 GB RAM, 2*200 GB HDD, Windows 7 64bit
SUSE LINUX 10.1
Mac G4, OSX 10.4.11, 80 GB HDD, 1,5 GB RAM
trevorlawrence
New User
New User
Posts: 3
Joined: Fri Jan 01, 2010 6:52 am

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

Post by trevorlawrence »

Advertising Spam removed by berikco
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

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

Post 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.
BERESHEIT
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

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

Post 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.
Post Reply