Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/07/02 17:00
Read: times


 
#22664 - More details on memory errors
Again, I inserted the sprintf() code into the example serial project that comes with the compiler. This is my code:

unsigned long num1 = 500;
char numstr1[5];
sprintf(numstr1, "Num 1 is %lu", num1);
se_print( numstr1 );

where the se_print() function expects a variable of type (const rom char *). This returns an error of "argument #2: memory spaces do not match", referring to the use of sprintf().

I looked again at the prototype for sprintf() and noticed that it expects a (const char *), so I declared const char *lu_str = "%lu"; and replaced the second argument of sprintf() with lu_str.

Now the error I get is "operands of '=' are not pointing to the same memory space" in reference to the declaration of lu_str.

Any ideas?

List of 29 messages in thread
TopicAuthorDate
Memory & strings; AT89C51            01/01/70 00:00      
RE: Memory & strings; AT89C51            01/01/70 00:00      
RE: Memory & strings; AT89C51            01/01/70 00:00      
RE: Memory & strings; AT89C51            01/01/70 00:00      
RE: Memory & strings; AT89C51            01/01/70 00:00      
RE: Memory & strings; AT89C51            01/01/70 00:00      
RE: Memory & strings - Niklas            01/01/70 00:00      
ASCII or Binary?            01/01/70 00:00      
RE: ASCII or Binary?            01/01/70 00:00      
RE: ASCII or Binary?            01/01/70 00:00      
RE: ASCII or Binary?            01/01/70 00:00      
RE: ASCII or Binary?            01/01/70 00:00      
RE: ASCII or Binary?            01/01/70 00:00      
RE: Memory & strings; AT89C51            01/01/70 00:00      
RE: Memory & strings; AT89C51            01/01/70 00:00      
RE: Memory & strings; AT89C51            01/01/70 00:00      
Confirmed compatible with Tasking            01/01/70 00:00      
RE: Confirmed compatible with Tasking            01/01/70 00:00      
Typo in above post            01/01/70 00:00      
RE: Confirmed compatible with Tasking            01/01/70 00:00      
RE: Confirmed compatible with Tasking            01/01/70 00:00      
RE: Confirmed compatible with Tasking            01/01/70 00:00      
More details on memory errors            01/01/70 00:00      
RE: Memory & strings; AT89C51            01/01/70 00:00      
RE: Memory & strings; AT89C51            01/01/70 00:00      
RE: More details on memory errors            01/01/70 00:00      
RE: Memory & strings; AT89C51            01/01/70 00:00      
RE: More details on memory errors            01/01/70 00:00      
RE: More details on memory errors            01/01/70 00:00      

Back to Subject List