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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/06/07 15:22
Read: times


 
#140319 - String to decimal numbers
Hi Folks,

This problem could be a breeze for such of those C-Experts in the audience.

For a particular application, I need to get about four parameters from a PC via RS232 to the MCU . This is done with ,
....
paramlist = scanf("%16s", buf);
....

The PC application simply transmits 16 digits at one go.

After this I need to 'extract" the four numbers which are each 4 digits wide. Subsequently each number is then stored in the MCU memory to carry out certain control functions.

Some elegant ideas to do the above stripping and storing is most welcome.

Thanks for your time.

Raghu

List of 39 messages in thread
TopicAuthorDate
String to decimal numbers            01/01/70 00:00      
   Piece of cake            01/01/70 00:00      
      Answer is correct - just do it 4 times!            01/01/70 00:00      
      No, Andy -- Joe\\\'s answer is not correct            01/01/70 00:00      
         simpler????            01/01/70 00:00      
            Simpler            01/01/70 00:00      
               scanf, printf....            01/01/70 00:00      
               scanf()            01/01/70 00:00      
                  Warnings well taken.            01/01/70 00:00      
         My response shows how to do it            01/01/70 00:00      
            the 1-line solution            01/01/70 00:00      
               Now that we\'re being silly ...            01/01/70 00:00      
                  I'm tempted to give it a "+1 Good answer" :-)            01/01/70 00:00      
                  As Cryptic as it can get.. (for me)            01/01/70 00:00      
                     Don't try this at home!!!            01/01/70 00:00      
                        Maybe try at home but NOT with the client !            01/01/70 00:00      
                  all 4 numbers, printf-ed, all in one for            01/01/70 00:00      
                     One small correction            01/01/70 00:00      
                        The world would come to a voilent end.            01/01/70 00:00      
                           this was nothing...            01/01/70 00:00      
                              Jan loves C ??? World go KAABOOM!!            01/01/70 00:00      
                     Jan, you are a wild man!!!            01/01/70 00:00      
                        I am cool serious.            01/01/70 00:00      
                           I've been learning C too!            01/01/70 00:00      
                              K&R            01/01/70 00:00      
                                 K&R * 3            01/01/70 00:00      
                                    The separation of AWK and Perl duly noted            01/01/70 00:00      
                                    I only have the one...            01/01/70 00:00      
   How about...            01/01/70 00:00      
      weekend quiz?            01/01/70 00:00      
         Ok, so it might have been a bit cryptic            01/01/70 00:00      
   Uncanny Adverts            01/01/70 00:00      
      OT - Google magic            01/01/70 00:00      
         Missed concepts..            01/01/70 00:00      
            Be careful            01/01/70 00:00      
               gets() is differently bad            01/01/70 00:00      
                  still better than scanf()            01/01/70 00:00      
                     or, don't bother with the stdlib etc. at all            01/01/70 00:00      
                        for me, replace 'rarely' with 'never'            01/01/70 00:00      

Back to Subject List