Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

CTime bug?

$
0
0

Gentlefolk,

I think I have found a problem with CTime. I am using it to parse for time / date escape sequences in a command line. It seems that if the command line is very long the parsing fails. I can reproduce the problem with the following mock-up code:

	CTime t = CTime::GetCurrentTime() ;
	CString PretendCommandLine ="0000000000""1111111111""2222222222""3333333333""4444444444""5555555555""6666666666""7777777777""8888888888""9999999999""0000000000""1111111111""2222222222""3333333333""4444444444" ;
	CString Converted = t.Format ( PretendCommandLine ) ;
	AfxMessageBox ( Converted ) ;

With the above example, the displayed Converted text is an empty string. However, if the pretend command line is shortened, I start to get what I would expect.

The real life application parses command lines that contain paths to files, so gets very long very easily.

Has anyone come across this before? Is there a work around?

Thanks, Andrew Ch.


Viewing all articles
Browse latest Browse all 15302