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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/03/02 12:30
Read: times


 
#22463 - RE: ASCII or Binary?


Andy Neil wrote:
-------------------------------
"Can somebody tell me how to correct my code to send a pointer instead of the string? "

Yes!

Your original code:
char numstr; // numstr is a single character
unsigned long num = 500; 
sprintf( numstr, "%lu", num ); // numstr here is a single character;
Corrected Code:
char numstr[LENGTH]; // numstr is an array of LENGTH characters 
unsigned long num = 500; 
sprintf( numstr, "%lu", num );// numstr points to the 1st character in numstr[]
ie, as Craig said, make numstr an Array, so that its name used alone is a pointer!

"I'm not very good at dealing with pointers."
Pointers are fundamental to the 'C' language - you need to get a good book on 'C' and swot-up on them!

"Thanks, I guess I'll have to take a look at the Keil compiler."

It's a 'C' language issue, not a compiler issue!

It works in the Raisonance compiler as well.

Bryan Whitton


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