Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Problem: VC++6.0 application diaplaying blank spaces are being optimized out in release mode


View products that this article applies to.

Rapid publishing

Source: Microsoft Support

↑ Back to the top


Action

RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.

↑ Back to the top


Result



The following sample code written�in VC 6.0,�works fine on Win2k3 SP1, but with Win2003 SP2 the blank spaces are being optimized out in release mode.

void main()
{���������������
wstring stringa(L"Hello");

data << setiosflags(ios::left) << setw(15) << stringa;
data << L"END";

��������� wcout << data.str();
��������� getch();
}

↑ Back to the top


Cause

Expected Results:-
Hello��������� END

Actual Results:
HelloEND

↑ Back to the top


Resolution

Functions like setiosflags & setw are being exposed by MSVCP60.dll and this is the DLL that is being loaded when this code is run. Win 2k3 Sp2 comes with different version of this DLL when compared with Win 2K3 SP1.

↑ Back to the top


More information



This issue can be resolved in two ways
A.�Under RELEASE Project Settings:
1.� Go to C++ Tab
2.�Select Category = �Code Generation�
3.�For �Use Run-Time Library�:�
If you select �Single-Threaded� or �Multi-Threaded� and build, it works fine

B.�Copy MSVCP60.dll of Win 2k3 Sp1 into application release folder and run the application

↑ Back to the top


Disclaimer

The advantage of using second method is that the application exe size will be less when compared with first option as it dynamically links with the DLL.

↑ Back to the top


Keywords: KB949078, kbrapidpub, kbnomt

↑ Back to the top

Article Info
Article ID : 949078
Revision : 3
Created on : 2/12/2008
Published on : 2/12/2008
Exists online : False
Views : 380