| ??? 12/18/09 18:55 Modified: 12/18/09 19:00 Read: times  | 
#171737 - Some help with copying strings in C (again) | 
I'm trying to use the following piece of code to copy a string to a buffer in order to send it over i2c. However, when I run it in the Keil simulator I can see it doing the copy, but then it's changing some of the characters (like the compiler's re-using the memory address). This is pretty much straight out of K&R, so I'm a bit confused.
 What am I missing?? Cheers, Rob. void send_i2c_data
        (
        unsigned char *str
        )
{
        unsigned int buffer_count = 0;
        unsigned char i2c_status;
		while ((*i2c_buffer = *str)!=' ')
		{
		str++;
		i2c_buffer++;
		buffer_count++;
		}
	
	i2c_status = i2c_transmit(0x60);
} | 
| Topic | Author | Date | 
| Some help with copying strings in C (again) | 01/01/70 00:00 | |
| Blast. | 01/01/70 00:00 | |
| ? | 01/01/70 00:00 | |
| Crunched function | 01/01/70 00:00 | |
| maybe | 01/01/70 00:00 | |
| = vs == | 01/01/70 00:00 | |
| ok | 01/01/70 00:00 | |
| '\0' | 01/01/70 00:00 | |
| just for record | 01/01/70 00:00 | |
| Both are ok. | 01/01/70 00:00 | |
| A warning - not an error | 01/01/70 00:00 | |
| Yes. Should have said "warning" | 01/01/70 00:00 | |
| but | 01/01/70 00:00 | |
                              Assign always spreads to the left, but mind the data type        | 01/01/70 00:00 | 



