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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/23/04 11:08
Read: times


 
#74738 - RE: What do you doubt?
Responding to: ???'s previous message
hi,

//This copies the string ok: 
sprintf(buff,"%s",source);

Well, it is right except that generally, sprintf() should not be used for string copying. When somebody uses sprintf() he must understand what he does. It is why I mentioned that sprintf() has nothing with "source" and "destination", it uses "buffer" and "format string" instead.
Moreover, I do not see a reason why it is need to use huge and complex sprintf() for string copy although there is quick and simple strcpy().
By the way, it is good example why programming requires keep track of correct usage of the terms and definitions:
- if I need modify string with format sequence then I use sprintf(). Letter "f" at the end of function name indicates "formating process";
- if I need to copy string (even if it is format string itself) then I use strcpy().

Regards,
Oleg

List of 19 messages in thread
TopicAuthorDate
doub about strutc pointers            01/01/70 00:00      
   RE: doub about strutc pointers            01/01/70 00:00      
   RE: doub about strutc pointers            01/01/70 00:00      
      What do you doubt?            01/01/70 00:00      
         RE: What do you doubt?            01/01/70 00:00      
            RE: What do you doubt?            01/01/70 00:00      
            RE: What do you doubt?            01/01/70 00:00      
               RE: What do you doubt?            01/01/70 00:00      
                  RE: What do you doubt?            01/01/70 00:00      
                  RE: What do you doubt?            01/01/70 00:00      
                     RE: What do you doubt?            01/01/70 00:00      
            RE: undefined behaviour land            01/01/70 00:00      
         RE: What do you doubt?            01/01/70 00:00      
         Still unknown doubt            01/01/70 00:00      
   RE: doub about strutc pointers            01/01/70 00:00      
      Nothing 8051-specific here            01/01/70 00:00      
         RE: Nothing 8051-specific here            01/01/70 00:00      
   RE: doub about strutc pointers            01/01/70 00:00      
   RE: doub about strutc pointers            01/01/70 00:00      

Back to Subject List