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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/14/08 12:26
Read: times


 
#159042 - return value?
Responding to: ???'s previous message
A tab is a single character. It is the receiving end - your terminal - that makes the decision how wide to display the tab character.

But you should avoid counting numbers. If a byte is larger than 99, then it doesn't matter if you have requested the output to be two characters wide.

One alternative - if you have the room and need the width before - is to use sprintf() and then eval strlen() or use the return value from sprintf().

I haven't checked the C51 RTL manual, but the standard printf() function is expected to return the number of printed characters - if it is enough to learn the number of characters after the write.

List of 17 messages in thread
TopicAuthorDate
How many bytes will be written ??            01/01/70 00:00      
   return value?            01/01/70 00:00      
      OT: That's why you should never use TABs!            01/01/70 00:00      
         go ahead and use tabs            01/01/70 00:00      
            No, don't!            01/01/70 00:00      
            Any programmers editor            01/01/70 00:00      
               insert spaces for TABs            01/01/70 00:00      
      Oh Yes ... the sprintf()...            01/01/70 00:00      
         So here we go            01/01/70 00:00      
            Wrong!            01/01/70 00:00      
               Valid warnings. But...            01/01/70 00:00      
                  No buts!            01/01/70 00:00      
                     maintability and engineering            01/01/70 00:00      
               Not entirely true?            01/01/70 00:00      
                  You are correct            01/01/70 00:00      
                     Good example of counting dangers            01/01/70 00:00      
                        Good interaction.            01/01/70 00:00      

Back to Subject List