const char

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

const char

1,084件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by blasiis on Thu Feb 03 08:05:07 MST 2011
LPC1758 with LPCXPresso
How can I define a string + number like this:

  const char Driver [18]= "ABCDEFGHILMN",{18,03,20,11,15,55};

Thanks
0 件の賞賛
返信
7 返答(返信)

1,069件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Feb 07 01:52:05 MST 2011
Don't know why strings in 'Expressions' are displayed octal, if they are not displayable as character set.

At the left side you can display your array in hex format, see:

http://support.code-red-tech.com/CodeRedWiki/DefaultDisplayFormats
0 件の賞賛
返信

1,069件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by blasiis on Mon Feb 07 00:45:26 MST 2011

Quote: Zero


"ABCEFGHILMN\022\003\024\v\017\067"

That's your string and your numbers (octal) :)



Why it is in octal format ??
Can I use a hex format ?
0 件の賞賛
返信

1,069件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Feb 04 07:30:43 MST 2011
It's possible, and already posted by CodeRedSupport :mad:

const char Driver []= {'A','B','C','E','F','G','H','I','L','M','N',18,03,20,11,15,55};

Watch Expression shows:

"ABCEFGHILMN\022\003\024\v\017\067"

That's your string and your numbers (octal) :)
0 件の賞賛
返信

1,069件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by blasiis on Fri Feb 04 06:59:30 MST 2011
Trying with 19
const char Driver [19]= = "ABCDEFGHILMN",{18,03,20,11,15,55};
I have the error expected identifier or '(' before '{' token
I think itisn't possible !
0 件の賞賛
返信

1,069件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Fri Feb 04 03:53:36 MST 2011
Hello blasiis,

Do not forget the '0' between the [B]'N'[/B] and the [B]18[/B] ... and the increase of the amount of array cells from 18 to 19.
0 件の賞賛
返信

1,069件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Fri Feb 04 00:31:04 MST 2011

Quote: blasiis

How can I define a string + number like this:

  const char Driver [18]= "ABCDEFGHILMN",{18,03,20,11,15,55};



I suspect that the compiler sees this as you trying to assign a two dimensional array (the string as one, the numbers as another) to your single dimensional Driver array.

Try this instead...
const char Driver [19]= {'A','B','C','D','E','F','G','H','I','L','M','N',0,18,03,20,11,15,55};
Regards,
CodeRedSupport
0 件の賞賛
返信

1,069件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jlara on Thu Feb 03 15:03:21 MST 2011
Each character in a string is an ASCII code representing the number.  For the letters, only one byte is needed.  For the numbers, each digit needs its own byte.  18 is not going to be enough.  What exactly are you trying to do?  If I know the end result, I will be able to help better.
0 件の賞賛
返信