Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

put byte value into a string

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-12-2008, 02:09 PM
Newbie
 
Join Date: Dec 2007
Posts: 7
Default put byte value into a string

I have made an decrypt routine. if i us a msgbox to display the result then the function works. When i want to put the result in an variable i got an error

how can i solve this problem


data() = Crypto.Decrypt(PassPhrase,secret())
Msgbox(bit.BytesToString(data(),0,ArrayLen(data()) ))
a=(bit.BytesToString(data(),0,ArrayLen(data())))
Reply With Quote
  #2 (permalink)  
Old 09-12-2008, 02:41 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Try removing the outmost parentheses surrounding the expression - for some reason in some circumstances the B4ppc parser doesn't like them
Quote:
Originally Posted by cotralis View Post
a=bit.BytesToString(data(),0,ArrayLen(data()))
Reply With Quote
  #3 (permalink)  
Old 09-12-2008, 03:05 PM
Newbie
 
Join Date: Dec 2007
Posts: 7
Default thanks

that is the solution for my problem

thank you for your quick reply
Reply With Quote
  #4 (permalink)  
Old 09-12-2008, 09:28 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

The parser treats expressions wrapped by parentheses as numeric expressions and therefore fails in this situation.
Code:
a = (b & c) 'ERROR
a = b & c 'OK
a = (5 + 2'OK
Reply With Quote
  #5 (permalink)  
Old 09-13-2008, 12:37 AM
Basic4ppc Expert
 
Join Date: May 2008
Location: Italy
Posts: 599
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Just out of curiosity - Is this by design (because Basic4PPC is weakly typed)?

Could this be avoided if we had to declare all our variables indicating also the datatype?

Rgds,
moster67


Quote:
Originally Posted by Erel View Post
The parser treats expressions wrapped by parentheses as numeric expressions and therefore fails in this situation.
Code:
a = (b & c) 'ERROR
a = b & c 'OK
a = (5 + 2'OK

Last edited by moster67 : 09-13-2008 at 12:48 AM.
Reply With Quote
  #6 (permalink)  
Old 09-13-2008, 03:30 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

This is by design. Yes, if Basic4ppc was strongly typed this assumption would not have been necessary.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Receiving byte with value of 0x1A Zenerdiode Questions (Windows Mobile) 10 11-23-2008 09:29 PM
Long String Georg Questions (Windows Mobile) 2 08-06-2008 08:20 AM
how to display chinese characters (High-ASCII, double-byte) using sqlite3 dennychuang Questions (Windows Mobile) 5 05-22-2008 04:39 PM
JPEG to byte array without writing to file brathbone Questions (Windows Mobile) 2 03-01-2008 05:59 AM
OK, next string question Stellaferox Questions (Windows Mobile) 9 06-07-2007 01:12 PM


All times are GMT. The time now is 07:43 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0