The problem is that the string constant "Hello World" is placed in ROM
(Flash). Your write to it through the pointer info cannot modify it.

 

Try

char info[] = "Hello World";

info[5] = 'Y';

 

  _____  

From: [email protected]
[mailto:[email protected]] On Behalf Of Pache Etienne
Sent: Wednesday, December 08, 2004 10:41 AM
To: [email protected]
Subject: [Mspgcc-users] simple problem with char*

 

Hello everybody !

 

I'm new in msp-gcc and I have a problem.

How can I modify one simple char* string ?   

 

If I do that :

"

     usart0Init(USART0_BAUD_DIV(9600), USART0_BAUD_MOD(9600), USART_8N1); 

     char *info;    
     info="Hello World";
     info[5]='Y';
     usart0Puts(info); 

"

 

the 'Y' didn't appear.

 

If this code didn't go OK, is someone who know how modify a char* declared
without malloc ?

 

Thanks a lot

 

Etienne

<<attachment: winmail.dat>>

Reply via email to