Click here to Skip to main content
15,900,816 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A SetFont problem Pin
Vincent Ye18-Jul-03 5:53
Vincent Ye18-Jul-03 5:53 
GeneralRe: A SetFont problem Pin
Joel Lucsy18-Jul-03 7:27
Joel Lucsy18-Jul-03 7:27 
GeneralRe: A SetFont problem Pin
Vincent Ye18-Jul-03 7:33
Vincent Ye18-Jul-03 7:33 
GeneralRe: A SetFont problem Pin
Ryan Binns18-Jul-03 19:23
Ryan Binns18-Jul-03 19:23 
QuestionHelp: How to set background bitmap for Rebar? Pin
bin892218-Jul-03 4:04
bin892218-Jul-03 4:04 
Generalstring to long part 2 Pin
si_6918-Jul-03 3:51
si_6918-Jul-03 3:51 
GeneralRe: string to long part 2 Pin
Ian Darling18-Jul-03 4:00
Ian Darling18-Jul-03 4:00 
GeneralRe: string to long part 2 Pin
RChin18-Jul-03 4:07
RChin18-Jul-03 4:07 
si_69 wrote:
which works ok, but it removes the leading zeros off
so im left with l = "123"


Leading zeros on a number has no significance to the value itself.
123, represented as a number implies an infinite number of leading zeros!.
123 == 0123 == 00123 == 000000123


If you, however, need to display your number with leading zeros, then you can either stick with your string representation, or use something like:

<br />
CString strValue;<br />
long nValue = 1234;<br />
<br />
// convert to string.<br />
// if number is less than 6 digits, pad with zeros.<br />
strValue.Format(_T("%.6ld"), nValue);<br />
<br />
// display to screen<br />
std::cout<<(LPCTSTR)strValue<<std::endl;<br />






"..Even my comments have bugs!"

Inspired by Toni78

GeneralRe: string to long part 2 Pin
Mike Nordell19-Jul-03 4:25
Mike Nordell19-Jul-03 4:25 
GeneralRe: string to long part 2 Pin
RChin20-Jul-03 23:26
RChin20-Jul-03 23:26 
GeneralRe: string to long part 2 Pin
John M. Drescher18-Jul-03 4:23
John M. Drescher18-Jul-03 4:23 
GeneralForcefully closeing a Winsock connection Pin
Giles18-Jul-03 3:29
Giles18-Jul-03 3:29 
GeneralRe: Forcefully closeing a Winsock connection Pin
Mike Nordell19-Jul-03 4:31
Mike Nordell19-Jul-03 4:31 
GeneralRe: Forcefully closeing a Winsock connection Pin
Giles19-Jul-03 4:50
Giles19-Jul-03 4:50 
GeneralRe: Forcefully closeing a Winsock connection Pin
Mike Nordell19-Jul-03 6:32
Mike Nordell19-Jul-03 6:32 
Generalkey press Pin
Newborn Naughtysaint18-Jul-03 3:14
Newborn Naughtysaint18-Jul-03 3:14 
GeneralRe: key press Pin
Xander8018-Jul-03 4:44
Xander8018-Jul-03 4:44 
GeneralRe: key press Pin
John M. Drescher18-Jul-03 8:34
John M. Drescher18-Jul-03 8:34 
GeneralBest way to test for file available Pin
captjack18-Jul-03 2:46
captjack18-Jul-03 2:46 
GeneralRe: Best way to test for file available Pin
Blake Miller18-Jul-03 5:33
Blake Miller18-Jul-03 5:33 
GeneralRe: Best way to test for file available Pin
captjack18-Jul-03 6:23
captjack18-Jul-03 6:23 
GeneralCopy/paste in CRichEditCtrl Pin
AnTri18-Jul-03 2:03
AnTri18-Jul-03 2:03 
GeneralRe: Copy/paste in CRichEditCtrl Pin
Dominik Reichl18-Jul-03 2:08
Dominik Reichl18-Jul-03 2:08 
QuestionHow to Capture HTML events in vc++? Pin
RaajaOfSelf18-Jul-03 2:02
RaajaOfSelf18-Jul-03 2:02 
GeneralDLL Hell Going From Win2000 to XP Pin
ttran770018-Jul-03 1:59
ttran770018-Jul-03 1:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.