Jump to content


Photo

Problem In Passing String Variable In Procedure Call


2 replies to this topic

#1 c58_4311

c58_4311

    Regular

  • EstablishedMember
  • Pip
  • 62 posts

Posted 26 March 2008 - 04:09 PM

There seams to be some problem in latest version (6.85) of boostbasic when passing string variables in procedures:


'code 0
sub print(a as string)
...
...
...
end sub

When we assign any string value to the 'a' variable, like

print("hello")

The value passed to variable 'a' get corrupted.


but if we modify the above code into following, we get correct results

'code 1
sub print(a as string)
...
...
...
end sub


dim x as string(10)
x = "hello"
print(x)



The Code 0 and Code 1, both worked correctly in the perevious version (6.84) of boostbasic.

#2 c58_4311

c58_4311

    Regular

  • EstablishedMember
  • Pip
  • 62 posts

Posted 31 March 2008 - 08:22 PM

Dear Dave please throw some light on this problem.

#3 Pavel

Pavel

    Super Maniac

  • Administrators
  • PipPipPipPipPip
  • 1,441 posts
  • Gender:Male
  • Location:Melbourne, Australia

Posted 03 April 2008 - 06:33 AM

This is bug in your code. You need to use string length in function/subroutine arguments too. Change your print declaration to:

sub print( a as string(10) )
...
...
...
end sub

Regards,
Pavel



Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users