Click here to Skip to main content
16,007,885 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: problem opening files in application Pin
12-Feb-02 7:03
suss12-Feb-02 7:03 
GeneralMs Word Automation and ActiveX Pin
Braulio Dez12-Feb-02 3:48
Braulio Dez12-Feb-02 3:48 
QuestionHow to remove this small error with sprintf Pin
tppradeep1812-Feb-02 1:26
tppradeep1812-Feb-02 1:26 
AnswerRe: How to remove this small error with sprintf Pin
Christian Graus12-Feb-02 1:33
protectorChristian Graus12-Feb-02 1:33 
GeneralRe: How to remove this small error with sprintf Pin
tppradeep1812-Feb-02 1:43
tppradeep1812-Feb-02 1:43 
AnswerRe: How to remove this small error with sprintf Pin
Kashif Manzoor12-Feb-02 2:01
Kashif Manzoor12-Feb-02 2:01 
GeneralRe: How to remove this small error with sprintf Pin
tppradeep1812-Feb-02 20:10
tppradeep1812-Feb-02 20:10 
AnswerRe: How to remove this small error with sprintf Pin
Atul Dharne12-Feb-02 7:02
Atul Dharne12-Feb-02 7:02 
#include < windows.h >
#include < tchar.h >
#include < stdio.h >

<font color=green>#define SIZE 80</font>

int test;
UINT retval;
LPCTSTR chTest;

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	char ascii;
	char ascTemp[SIZE];
	ascii = 'A';
	while (ascii <= 'Z') {
		<font color=green>test = _snprintf(ascTemp,SIZE,"%c:\\",ascii);  </font>
        if (GetDriveType(ascTemp)== DRIVE_CDROM)
        {
			<font color=green>_snprintf(ascTemp,SIZE,"Found CDROM %c:\\",ascii);</font>
			test = MessageBoxEx(NULL, ascTemp, "CDROM Drive", MB_OK, 0);
		}
		++ascii;
	}
    return 0;
} 


It works..try it. Use _snprintf instead of sprintf for bounds safety.

Atul

Sonork ID : 100.13714 netdiva
GeneralPrinter connection Pin
Stan the man12-Feb-02 1:05
Stan the man12-Feb-02 1:05 
GeneralRe: Printer connection Pin
Bernhard12-Feb-02 4:20
Bernhard12-Feb-02 4:20 
GeneralNT service in dll Pin
Don Miguel12-Feb-02 0:48
Don Miguel12-Feb-02 0:48 
GeneralRe: NT service in dll Pin
Mazdak12-Feb-02 3:33
Mazdak12-Feb-02 3:33 
GeneralRe: NT service in dll Pin
Carlos Antollini12-Feb-02 3:53
Carlos Antollini12-Feb-02 3:53 
GeneralRe: NT service in dll Pin
Don Miguel12-Feb-02 7:53
Don Miguel12-Feb-02 7:53 
GeneralRe: NT service in dll Pin
Carlos Antollini12-Feb-02 8:10
Carlos Antollini12-Feb-02 8:10 
GeneralRe: NT service in dll Pin
Don Miguel12-Feb-02 8:13
Don Miguel12-Feb-02 8:13 
Generalexcel functions called from VC++ Pin
12-Feb-02 0:39
suss12-Feb-02 0:39 
GeneralRe: excel functions called from VC++ Pin
Christian Graus12-Feb-02 1:16
protectorChristian Graus12-Feb-02 1:16 
GeneralOpenGL and resident texture objects Pin
11-Feb-02 23:54
suss11-Feb-02 23:54 
Generalregistry backup Pin
11-Feb-02 22:11
suss11-Feb-02 22:11 
GeneralRe: registry backup Pin
Christian Graus11-Feb-02 22:22
protectorChristian Graus11-Feb-02 22:22 
GeneralRe: registry backup Pin
Mazdak11-Feb-02 22:48
Mazdak11-Feb-02 22:48 
GeneralRe: registry backup Pin
Simon Walton11-Feb-02 23:41
Simon Walton11-Feb-02 23:41 
GeneralRe: registry backup Pin
Nish Nishant12-Feb-02 0:54
sitebuilderNish Nishant12-Feb-02 0:54 
QuestionHow to minimize an application using CPropertySheet to the systray Pin
11-Feb-02 21:29
suss11-Feb-02 21:29 

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.