dev-cpp-users Mailing List for Dev-C++ (Page 364)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Krzysztof K. <sa...@op...> - 2003-06-20 12:34:14
|
Hello Vlada,
Friday, June 20, 2003, 2:23:39 PM, you wrote:
VD> ----- Original Message -----
VD> From: "Krzysztof 'Saveman' Kapuscik" <sa...@ze...>
VD> To: <dev...@li...>
VD> Sent: Friday, June 20, 2003 1:48 PM
VD> Subject: Re: [Dev-C++] display bitmap
>> Hello Vlada,
>>
>> Friday, June 20, 2003, 12:27:55 PM, you wrote:
>>
>> VD> Hi.
>> VD> In this piece of code, I try to load bitmap image from a file and
VD> display it
>> VD> in a window. When I run the program, nothing happens. After the call
VD> to
>> VD> LoadImage(), I call the error() function, which calls GetLastError()
VD> and
>> VD> displays a message box with error description. In this way, I receive
VD> a
>> VD> message "Not enough storage is available to process this command".
VD> Now, I'm
>> VD> not sure if there something wrong with the code, or I realy run out of
>> VD> memory (which I doubt). My computer is Pentium 2 with 128 MB RAM and
VD> 20GB
>> VD> hard drive. This code is actually the only code in this program,
VD> except for
>> VD> standard Windows code, so I don't think there should be any memory
VD> leak. Can
>> VD> you tell me if the code is OK?
>> VD> P.S. I should also say that there's no message "Could not load image",
VD> so I
>> VD> guess the bitmap handle is valid?
>> VD> How can that be if LoadImage() could not be completed?
>> VD> -------------------------------------
>> VD> ------------
>> VD> Vlada
>>
>> I don't know what's wrong with you code, because it works on my machine :)
>>
>> But I changed it a bit - look there:
>> (i putted it into WindowProcedure)
>>
>> HBITMAP hBitmap;
>> LPTSTR szFileName = TEXT("bitmapa.bmp");
>> BITMAP bmp;
>> HBITMAP hOldBMP;
>> PAINTSTRUCT ps;
>> HDC hDC;
>> HDC memDC;
>>
>> switch (message) /* handle the messages */
>> {
>> case WM_PAINT:
>> hBitmap =(HBITMAP)LoadImage(GetModuleHandle(NULL), szFileName,
>> IMAGE_BITMAP, 0, 0,
VD> LR_LOADFROMFILE|LR_CREATEDIBSECTION);
>> if(hBitmap)
>> {
>> GetObject(hBitmap, sizeof(BITMAP), &bmp);
>> hDC = BeginPaint(hwnd, &ps);
>> memDC = CreateCompatibleDC(hDC);
>> hOldBMP = (HBITMAP)SelectObject(memDC, hBitmap);
>> BitBlt(hDC, 0, 0, bmp.bmWidth, bmp.bmHeight, memDC, 0, 0,
VD> SRCCOPY);
>> SelectObject(memDC, hOldBMP);
>> DeleteDC(memDC);
>> EndPaint(hwnd, &ps);
>> DeleteObject(hBitmap);
>> }
>> else
>> {
>> // you could get additional info about error here
>> // using GetLastError()
>> MessageBox(hwnd, "Could not load image", "Error", MB_OK);
>> }
>> break;
>> case WM_DESTROY:
>> PostQuitMessage (0); /* send a WM_QUIT to the message
VD> queue */
>> break;
>> default: /* for messages that we don't deal
VD> with */
>> return DefWindowProc (hwnd, message, wParam, lParam);
>> }
>>
>>
>> Check if your "bitmapa.bmp" file is inside default program directory...
>>
>> --
>> Best regards,
>> Krzysztof
>>
>> mailto:sa...@op...
>> http://www.saveman.w.pl
>>
>>
VD> I got it working now. The thing is that I was using the code in response to
VD> WM_LBUTTONDOWN message, and now I changed it to use GetDC() for obtaining
VD> device context instead of BeginPaint(). Thanks for help, guys.But would like
VD> to now why I was getting that strange error. I can't believe it's that wrong
VD> to use BeginPaint() outside the WM_PAINT message?
From MSDN:
An application should not call BeginPaint except in response
to a WM_PAINT message. Each call to BeginPaint must have a
corresponding call to the EndPaint function.
--
Best regards,
Krzysztof
mailto:sa...@op...
http://www.saveman.w.pl
|
|
From: Krzysztof K. <sa...@op...> - 2003-06-20 12:26:55
|
Hello Daniel, Friday, June 20, 2003, 2:06:04 PM, you wrote: DG> If the bitmap couldn't be found though the error message would say so DG> wouldn't it? DG> There's another GetLastError() call I think called GetLastErrorEx() or DG> something (look on MSDN.com), maybe that will give more details? DG> Glad to hear the code works on someone's machine anyway! DG> Maybe the bitmap is too difficult to read? Is it a simple image? DG> Krzysztof what colour depth was your bitmap, maybe the code fails if it is DG> 24-bit or above perhaps? That matters a lot I hear with bitmaps. The bitmap params was: 144 x 15 x 16 colors I checked it also with bigger image: 1024 x 768 x 24bits (colors = 16.7 mln) With both of them program works without errors. A small hiny: LoadImage have problems with loading compressed bitmaps... I don't know why, my friend told me this and i trust him, because he is writting Windows apps for a long time. (Compressed bitmaps use RLE encoding scheme (Run Length Encoding)). He use: OleInitialize and OleLoadPicturePath I have his code how to do this but it is written in assembler... -- Best regards, Krzysztof mailto:sa...@op... http://www.saveman.w.pl |
|
From: Vlada D. <dj...@im...> - 2003-06-20 12:24:12
|
----- Original Message -----
From: "Krzysztof 'Saveman' Kapuscik" <sa...@ze...>
To: <dev...@li...>
Sent: Friday, June 20, 2003 1:48 PM
Subject: Re: [Dev-C++] display bitmap
> Hello Vlada,
>
> Friday, June 20, 2003, 12:27:55 PM, you wrote:
>
> VD> Hi.
> VD> In this piece of code, I try to load bitmap image from a file and
display it
> VD> in a window. When I run the program, nothing happens. After the call
to
> VD> LoadImage(), I call the error() function, which calls GetLastError()
and
> VD> displays a message box with error description. In this way, I receive
a
> VD> message "Not enough storage is available to process this command".
Now, I'm
> VD> not sure if there something wrong with the code, or I realy run out of
> VD> memory (which I doubt). My computer is Pentium 2 with 128 MB RAM and
20GB
> VD> hard drive. This code is actually the only code in this program,
except for
> VD> standard Windows code, so I don't think there should be any memory
leak. Can
> VD> you tell me if the code is OK?
> VD> P.S. I should also say that there's no message "Could not load image",
so I
> VD> guess the bitmap handle is valid?
> VD> How can that be if LoadImage() could not be completed?
> VD> -------------------------------------
> VD> ------------
> VD> Vlada
>
> I don't know what's wrong with you code, because it works on my machine :)
>
> But I changed it a bit - look there:
> (i putted it into WindowProcedure)
>
> HBITMAP hBitmap;
> LPTSTR szFileName = TEXT("bitmapa.bmp");
> BITMAP bmp;
> HBITMAP hOldBMP;
> PAINTSTRUCT ps;
> HDC hDC;
> HDC memDC;
>
> switch (message) /* handle the messages */
> {
> case WM_PAINT:
> hBitmap =(HBITMAP)LoadImage(GetModuleHandle(NULL), szFileName,
> IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
> if(hBitmap)
> {
> GetObject(hBitmap, sizeof(BITMAP), &bmp);
> hDC = BeginPaint(hwnd, &ps);
> memDC = CreateCompatibleDC(hDC);
> hOldBMP = (HBITMAP)SelectObject(memDC, hBitmap);
> BitBlt(hDC, 0, 0, bmp.bmWidth, bmp.bmHeight, memDC, 0, 0,
SRCCOPY);
> SelectObject(memDC, hOldBMP);
> DeleteDC(memDC);
> EndPaint(hwnd, &ps);
> DeleteObject(hBitmap);
> }
> else
> {
> // you could get additional info about error here
> // using GetLastError()
> MessageBox(hwnd, "Could not load image", "Error", MB_OK);
> }
> break;
> case WM_DESTROY:
> PostQuitMessage (0); /* send a WM_QUIT to the message
queue */
> break;
> default: /* for messages that we don't deal
with */
> return DefWindowProc (hwnd, message, wParam, lParam);
> }
>
>
> Check if your "bitmapa.bmp" file is inside default program directory...
>
> --
> Best regards,
> Krzysztof
>
> mailto:sa...@op...
> http://www.saveman.w.pl
>
>
I got it working now. The thing is that I was using the code in response to
WM_LBUTTONDOWN message, and now I changed it to use GetDC() for obtaining
device context instead of BeginPaint(). Thanks for help, guys.But would like
to now why I was getting that strange error. I can't believe it's that wrong
to use BeginPaint() outside the WM_PAINT message?
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: INetU
> Attention Web Developers & Consultants: Become An INetU Hosting Partner.
> Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
> INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Daniel G. <sp...@ho...> - 2003-06-20 12:06:10
|
If the bitmap couldn't be found though the error message would say so wouldn't it? There's another GetLastError() call I think called GetLastErrorEx() or something (look on MSDN.com), maybe that will give more details? Glad to hear the code works on someone's machine anyway! Maybe the bitmap is too difficult to read? Is it a simple image? Krzysztof what colour depth was your bitmap, maybe the code fails if it is 24-bit or above perhaps? That matters a lot I hear with bitmaps. >From: Krzysztof 'Saveman' Kapuscik <sa...@ze...> >Reply-To: Krzysztof Kapuscik <sa...@op...> >To: dev...@li... >Subject: Re: [Dev-C++] display bitmap >Date: Fri, 20 Jun 2003 13:48:18 +0200 > >Hello Vlada, > >Friday, June 20, 2003, 12:27:55 PM, you wrote: > >VD> Hi. >VD> In this piece of code, I try to load bitmap image from a file and >display it >VD> in a window. When I run the program, nothing happens. After the call to >VD> LoadImage(), I call the error() function, which calls GetLastError() >and >VD> displays a message box with error description. In this way, I receive a >VD> message "Not enough storage is available to process this command". Now, >I'm >VD> not sure if there something wrong with the code, or I realy run out of >VD> memory (which I doubt). My computer is Pentium 2 with 128 MB RAM and >20GB >VD> hard drive. This code is actually the only code in this program, except >for >VD> standard Windows code, so I don't think there should be any memory >leak. Can >VD> you tell me if the code is OK? >VD> P.S. I should also say that there's no message "Could not load image", >so I >VD> guess the bitmap handle is valid? >VD> How can that be if LoadImage() could not be completed? >VD> ------------------------------------- >VD> ------------ >VD> Vlada > >I don't know what's wrong with you code, because it works on my machine :) > >But I changed it a bit - look there: >(i putted it into WindowProcedure) > > HBITMAP hBitmap; > LPTSTR szFileName = TEXT("bitmapa.bmp"); > BITMAP bmp; > HBITMAP hOldBMP; > PAINTSTRUCT ps; > HDC hDC; > HDC memDC; > > switch (message) /* handle the messages */ > { > case WM_PAINT: > hBitmap =(HBITMAP)LoadImage(GetModuleHandle(NULL), szFileName, > IMAGE_BITMAP, 0, 0, >LR_LOADFROMFILE|LR_CREATEDIBSECTION); > if(hBitmap) > { > GetObject(hBitmap, sizeof(BITMAP), &bmp); > hDC = BeginPaint(hwnd, &ps); > memDC = CreateCompatibleDC(hDC); > hOldBMP = (HBITMAP)SelectObject(memDC, hBitmap); > BitBlt(hDC, 0, 0, bmp.bmWidth, bmp.bmHeight, memDC, 0, 0, >SRCCOPY); > SelectObject(memDC, hOldBMP); > DeleteDC(memDC); > EndPaint(hwnd, &ps); > DeleteObject(hBitmap); > } > else > { > // you could get additional info about error here > // using GetLastError() > MessageBox(hwnd, "Could not load image", "Error", MB_OK); > } > break; > case WM_DESTROY: > PostQuitMessage (0); /* send a WM_QUIT to the message >queue */ > break; > default: /* for messages that we don't deal >with */ > return DefWindowProc (hwnd, message, wParam, lParam); > } > > >Check if your "bitmapa.bmp" file is inside default program directory... > >-- >Best regards, > Krzysztof > >mailto:sa...@op... >http://www.saveman.w.pl > > > > >------------------------------------------------------- >This SF.Net email is sponsored by: INetU >Attention Web Developers & Consultants: Become An INetU Hosting Partner. >Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission! >INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Get Hotmail on your mobile phone http://www.msn.co.uk/msnmobile |
|
From: Brian J. A. <bri...@gm...> - 2003-06-20 11:50:26
|
Yeoh, I shall look into this immediately! Thank you, this is exactly what I've been looking for Brian Ackermann Yeoh HS wrote: >If you want to know how to create the required wxWindows .a library file for >use with Dev-C++ 4.9.8.0 (GCC 3.2), here's some information for you. > >Download the HOW-TO at this URL: >http://www.yeohhs.com/shareware/wxMSWandDevCppV-1.0.zip >(File Size: 3.4K) > >Best Regards, >Yeoh > > |
|
From: Krzysztof 'S. K. <sa...@ze...> - 2003-06-20 11:49:29
|
Hello Vlada,
Friday, June 20, 2003, 12:27:55 PM, you wrote:
VD> Hi.
VD> In this piece of code, I try to load bitmap image from a file and display it
VD> in a window. When I run the program, nothing happens. After the call to
VD> LoadImage(), I call the error() function, which calls GetLastError() and
VD> displays a message box with error description. In this way, I receive a
VD> message "Not enough storage is available to process this command". Now, I'm
VD> not sure if there something wrong with the code, or I realy run out of
VD> memory (which I doubt). My computer is Pentium 2 with 128 MB RAM and 20GB
VD> hard drive. This code is actually the only code in this program, except for
VD> standard Windows code, so I don't think there should be any memory leak. Can
VD> you tell me if the code is OK?
VD> P.S. I should also say that there's no message "Could not load image", so I
VD> guess the bitmap handle is valid?
VD> How can that be if LoadImage() could not be completed?
VD> -------------------------------------
VD> ------------
VD> Vlada
I don't know what's wrong with you code, because it works on my machine :)
But I changed it a bit - look there:
(i putted it into WindowProcedure)
HBITMAP hBitmap;
LPTSTR szFileName = TEXT("bitmapa.bmp");
BITMAP bmp;
HBITMAP hOldBMP;
PAINTSTRUCT ps;
HDC hDC;
HDC memDC;
switch (message) /* handle the messages */
{
case WM_PAINT:
hBitmap =(HBITMAP)LoadImage(GetModuleHandle(NULL), szFileName,
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION);
if(hBitmap)
{
GetObject(hBitmap, sizeof(BITMAP), &bmp);
hDC = BeginPaint(hwnd, &ps);
memDC = CreateCompatibleDC(hDC);
hOldBMP = (HBITMAP)SelectObject(memDC, hBitmap);
BitBlt(hDC, 0, 0, bmp.bmWidth, bmp.bmHeight, memDC, 0, 0, SRCCOPY);
SelectObject(memDC, hOldBMP);
DeleteDC(memDC);
EndPaint(hwnd, &ps);
DeleteObject(hBitmap);
}
else
{
// you could get additional info about error here
// using GetLastError()
MessageBox(hwnd, "Could not load image", "Error", MB_OK);
}
break;
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
break;
default: /* for messages that we don't deal with */
return DefWindowProc (hwnd, message, wParam, lParam);
}
Check if your "bitmapa.bmp" file is inside default program directory...
--
Best regards,
Krzysztof
mailto:sa...@op...
http://www.saveman.w.pl
|
|
From: Vlada D. <dj...@im...> - 2003-06-20 11:16:58
|
----- Original Message -----
From: "Daniel Glenfield" <sp...@ho...>
To: <dj...@im...>; <dev...@li...>
Sent: Friday, June 20, 2003 12:48 PM
Subject: Re: [Dev-C++] display bitmap
> Have you run this program and not had an error yet? Because I think you
are
> deleting a DC but you've not called DeleteObject(), so the memory is still
> being used.
>
> Try a shut down and reboot, and chang ethe code before trying again.
>
This happens since the first time I ran the program. Anyway, I did a reboot,
and changed the code:
HBITMAP hOldBMP=(HBITMAP)SelectObject(memDC,hBitmap);
BitBlt(.......);
SelectObject(memDC,hOldBMP);
DeleteDC(memDC);
but still same thing. I think that even with a memory leak, it sholud run at
least a few times, asuming there's nothing wrong with the code. Maybe I
shold try it on some other machine?
>
> >From: "Vlada Djurovic" <dj...@im...>
> >To: "'DevC++ help'" <dev...@li...>
> >Subject: [Dev-C++] display bitmap
> >Date: Fri, 20 Jun 2003 12:27:55 +0200
> >
> >Hi.
> >In this piece of code, I try to load bitmap image from a file and display
> >it
> >in a window. When I run the program, nothing happens. After the call to
> >LoadImage(), I call the error() function, which calls GetLastError() and
> >displays a message box with error description. In this way, I receive a
> >message "Not enough storage is available to process this command". Now,
I'm
> >not sure if there something wrong with the code, or I realy run out of
> >memory (which I doubt). My computer is Pentium 2 with 128 MB RAM and 20GB
> >hard drive. This code is actually the only code in this program, except
for
> >standard Windows code, so I don't think there should be any memory leak.
> >Can
> >you tell me if the code is OK?
> >P.S. I should also say that there's no message "Could not load image", so
I
> >guess the bitmap handle is valid?
> >How can that be if LoadImage() could not be completed?
> >---------------------
> > LPTSTR szFileName=TEXT("bitmapa.bmp");
> > HBITMAP
>
>hBitmap=(HBITMAP)LoadImage(GetModuleHandle(NULL),szFileName,IMAGE_BITMAP,0,
0
> >,
> > LR_LOADFROMFILE|LR_CREATEDIBSECTION);
> > error(); //this function calls GetLastError() and
displays
> >a
> >message box
> > if(!hBitmap)
> > MessageBox(hwnd,"Could not load image","Error",MB_OK);
> > BITMAP bmp;
> > GetObject(hBitmap,sizeof(BITMAP),&bmp);
> > PAINTSTRUCT ps;
> > HDC hDC=BeginPaint(hwnd,&ps);
> > HDC memDC=CreateCompatibleDC(hDC);
> > SelectObject(memDC,hBitmap);
> >
BitBlt(hDC,0,0,bmp.bmWidth,bmp.bmHeight,memDC,0,0,SRCCOPY);
> > DeleteDC(memDC);
> > EndPaint(hwnd,&ps);
> >-------------------------------------
> >------------
> >Vlada
> >
> >
> >
> >-------------------------------------------------------
> >This SF.Net email is sponsored by: INetU
> >Attention Web Developers & Consultants: Become An INetU Hosting Partner.
> >Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
> >INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
> >_______________________________________________
> >Dev-cpp-users mailing list
> >Dev...@li...
> >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
> _________________________________________________________________
> Stay in touch with absent friends - get MSN Messenger
> http://www.msn.co.uk/messenger
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: INetU
> Attention Web Developers & Consultants: Become An INetU Hosting Partner.
> Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
> INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Daniel G. <sp...@ho...> - 2003-06-20 10:48:19
|
Have you run this program and not had an error yet? Because I think you are
deleting a DC but you've not called DeleteObject(), so the memory is still
being used.
Try a shut down and reboot, and chang ethe code before trying again.
>From: "Vlada Djurovic" <dj...@im...>
>To: "'DevC++ help'" <dev...@li...>
>Subject: [Dev-C++] display bitmap
>Date: Fri, 20 Jun 2003 12:27:55 +0200
>
>Hi.
>In this piece of code, I try to load bitmap image from a file and display
>it
>in a window. When I run the program, nothing happens. After the call to
>LoadImage(), I call the error() function, which calls GetLastError() and
>displays a message box with error description. In this way, I receive a
>message "Not enough storage is available to process this command". Now, I'm
>not sure if there something wrong with the code, or I realy run out of
>memory (which I doubt). My computer is Pentium 2 with 128 MB RAM and 20GB
>hard drive. This code is actually the only code in this program, except for
>standard Windows code, so I don't think there should be any memory leak.
>Can
>you tell me if the code is OK?
>P.S. I should also say that there's no message "Could not load image", so I
>guess the bitmap handle is valid?
>How can that be if LoadImage() could not be completed?
>---------------------
> LPTSTR szFileName=TEXT("bitmapa.bmp");
> HBITMAP
>hBitmap=(HBITMAP)LoadImage(GetModuleHandle(NULL),szFileName,IMAGE_BITMAP,0,0
>,
> LR_LOADFROMFILE|LR_CREATEDIBSECTION);
> error(); //this function calls GetLastError() and displays
>a
>message box
> if(!hBitmap)
> MessageBox(hwnd,"Could not load image","Error",MB_OK);
> BITMAP bmp;
> GetObject(hBitmap,sizeof(BITMAP),&bmp);
> PAINTSTRUCT ps;
> HDC hDC=BeginPaint(hwnd,&ps);
> HDC memDC=CreateCompatibleDC(hDC);
> SelectObject(memDC,hBitmap);
> BitBlt(hDC,0,0,bmp.bmWidth,bmp.bmHeight,memDC,0,0,SRCCOPY);
> DeleteDC(memDC);
> EndPaint(hwnd,&ps);
>-------------------------------------
>------------
>Vlada
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: INetU
>Attention Web Developers & Consultants: Become An INetU Hosting Partner.
>Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
>INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger
http://www.msn.co.uk/messenger
|
|
From: <or...@vp...> - 2003-06-20 10:44:04
|
Yeoh HS wrote: > Dear fellow Dev-C++ users, > > Dev-C++ is a great tool and with its many DevPaks, it is even more useful. > But sometimes you want to use some C++ library but couldn't find any DevPaks > for it. You don't really need a DevPak. What you need are the .a library > file(s) and the C++ header files. If the C++ library comes with source and > also contains the build scripts, you might be able to create the required .a > files. This is possible only if the configure scripts are also built for > MinGW. What follows is an account of one C++ adventure. > > If you want to know how to create the required wxWindows .a library file for > use with Dev-C++ 4.9.8.0 (GCC 3.2), here's some information for you. > > Download the HOW-TO at this URL: > http://www.yeohhs.com/shareware/wxMSWandDevCppV-1.0.zip > (File Size: 3.4K) That's fine. But why not use the makefiles provided by wxWindows to build under MinGW, src/makefile.g95 and such? It builds the whole stuff. And also a LOT of options can be specified in include/wx/mswsetup.h (OpenGL, and MANY MANY other things) to reduce the library, or provide backward compatibility with older wxWindows programs. Though you need to edit it before the start of the compilation. -- Regards, Balázs |
|
From: Vlada D. <dj...@im...> - 2003-06-20 10:29:17
|
Hi.
In this piece of code, I try to load bitmap image from a file and display it
in a window. When I run the program, nothing happens. After the call to
LoadImage(), I call the error() function, which calls GetLastError() and
displays a message box with error description. In this way, I receive a
message "Not enough storage is available to process this command". Now, I'm
not sure if there something wrong with the code, or I realy run out of
memory (which I doubt). My computer is Pentium 2 with 128 MB RAM and 20GB
hard drive. This code is actually the only code in this program, except for
standard Windows code, so I don't think there should be any memory leak. Can
you tell me if the code is OK?
P.S. I should also say that there's no message "Could not load image", so I
guess the bitmap handle is valid?
How can that be if LoadImage() could not be completed?
---------------------
LPTSTR szFileName=TEXT("bitmapa.bmp");
HBITMAP
hBitmap=(HBITMAP)LoadImage(GetModuleHandle(NULL),szFileName,IMAGE_BITMAP,0,0
,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
error(); //this function calls GetLastError() and displays a
message box
if(!hBitmap)
MessageBox(hwnd,"Could not load image","Error",MB_OK);
BITMAP bmp;
GetObject(hBitmap,sizeof(BITMAP),&bmp);
PAINTSTRUCT ps;
HDC hDC=BeginPaint(hwnd,&ps);
HDC memDC=CreateCompatibleDC(hDC);
SelectObject(memDC,hBitmap);
BitBlt(hDC,0,0,bmp.bmWidth,bmp.bmHeight,memDC,0,0,SRCCOPY);
DeleteDC(memDC);
EndPaint(hwnd,&ps);
-------------------------------------
------------
Vlada
|
|
From: Shane B. <ast...@te...> - 2003-06-20 08:04:16
|
MessageYour idea suggest a significant performance boost, if I was =
referencing the memory with accessing optimization. The issue here, is =
accessing, it's allocation performance.
As I believe you meant,
"new class_type[count]"
is equivilent to,
"malloc(count * sizeof(class_type))"
This is the fastest method I can determine for allocation, however the =
issue is that I want to allocate this memory to be used and delete'd not =
as an array, but perhaps individually. What I mean is, currently the =
memory is allocated with many calls to "new", whereas one call to new, =
allocating all the memory at once would be faster. However, I cannot =
take a pointer to a specific element of the array and only delete that =
memory when it's no longer needed, I would require a management system =
of the array.
Herein lies the problem, the array must be allocated and deleted =
entirely. Multiple calls to "new" is required to ensure each memory is =
allocated and internally tracked separately. I do not want one large =
chunk of memory accessed as an array, but rather simply to preallocate =
the required memory all at once for a specific number of objects.
The actual situation, involves as I said before, loading 48k records =
from a database, and for each, creating an object. I do not want this =
in an array, each object is later stored in an STL map and indexed =
according to a unique value. I just want to preallocate, calling =
constructors correctly, 48k objects, and then use one at a time into the =
map, and may later be individually deleted out of the map by expiration =
of individual records.
Your suggestion to use a vector does not imply allocating with new, as =
is needed for each to be allocated correctly and constructed properly. =
There may not be a better solution than calling new 48k times, =
unfortunately.
I thought perhaps at a lower level you could preallocate a whole chunk =
of memory, then with another special call, construct an object in =
preallocated memory. This would speed up as I would just iterate =
through the construction of each object after allocating for 48k =
objects, instead of calling new 48k times separately allocating each =
time.
With using any sort of memory manager to manage an array of preallocated =
memory would probably negate the speed increase.
-Shane
p.s. I am really nitpicking here, the entire process takes about 30 =
seconds on average, running on the same server as the database, on low =
end home hardware, 350mhz, 256megs of ram, and a standard 5400rpm IDE =
drive. Nothing special, if there are no lower level calls as I =
described above, then I can live with the loading time.
----- Original Message -----=20
From: Ioannis Vranos=20
To: 'C++'=20
Sent: Thursday, June 19, 2003 8:47 PM
Subject: RE: [Dev-C++] Optimized memory allocation
new whatever[SIZE] is equivalent to malloc(SIZE*sizeof(whatever)), =
that is it should boe slower.
But better use an std::vector:
#include <vector>
// ...
using std::vector;
// ...
vector<class_type> array(48);
// ...
array[0]=3D ...
Ioannis Vranos
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL 1: http://run.to/noicys
* Alternative URL 2: http://www.noicys.cjb.net=20
-----Original Message-----
From: dev...@li... =
[mailto:dev...@li...] On Behalf Of Shane =
Bryldt
Sent: Friday, June 20, 2003 3:39 AM
To: C++
Subject: [Dev-C++] Optimized memory allocation
Hello,
I have recently been attempting to find ways to speed up the =
process of loading 48k records from a MySQL SELECT statement, which has =
a 32 char primary key. One of the more intensive processes involved is =
calling "new" to create a new object 48k times. In standard C, I would =
malloc(RowCount * sizeof(class_type)), and using pointer math, simply =
iterate whenever I needed a new structure. With C++, a call to new is =
required for construction purposes. Is there an optimized method =
wherein I can allocate a dynamic number to be preallocated more =
efficiently all at once in one call?
I have considered using "new class_type[RowCount]()" to allocate =
an array (haven't tried to see if that would actually work), but I was =
wondering if there was a more efficient means to preallocate objects.
Thanks,
-Shane |
|
From: Ioannis V. <iv...@em...> - 2003-06-20 03:20:52
|
Bug fix: =20 -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Ioannis Vranos Sent: Friday, June 20, 2003 5:48 AM To: 'C++' Subject: RE: [Dev-C++] Optimized memory allocation =3D=3D> new whatever[SIZE] should be equivalent to malloc(SIZE*sizeof(whatever)) in terms of speed, where whatever is a = POD type. =20 But better use an std::vector: =20 =20 #include <vector> =20 // ... =20 using std::vector; =20 // ... =20 vector<class_type> array(48); =20 // ... array[0]=3D ... =20 =20 =20 =20 =20 Ioannis Vranos * Programming pages: <http://www.noicys.freeurl.com/> http://www.noicys.freeurl.com * Alternative URL 1: <http://run.to/noicys> http://run.to/noicys * Alternative URL 2: <http://www.noicys.cjb.net/> = http://www.noicys.cjb.net =20 =20 =20 -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Shane = Bryldt Sent: Friday, June 20, 2003 3:39 AM To: C++ Subject: [Dev-C++] Optimized memory allocation Hello, =20 I have recently been attempting to find ways to speed up the process = of loading 48k records from a MySQL SELECT statement, which has a 32 char primary key. One of the more intensive processes involved is calling = "new" to create a new object 48k times. In standard C, I would = malloc(RowCount * sizeof(class_type)), and using pointer math, simply iterate whenever I needed a new structure. With C++, a call to new is required for construction purposes. Is there an optimized method wherein I can = allocate a dynamic number to be preallocated more efficiently all at once in one call? I have considered using "new class_type[RowCount]()" to allocate an array (haven't tried to see if that would actually work), but I was wondering if there was a more efficient means to preallocate objects. =20 Thanks, -Shane |
|
From: Ioannis V. <iv...@em...> - 2003-06-20 02:52:19
|
Keep up the good work Yeoh! Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Yeoh HS > Sent: Friday, June 20, 2003 4:54 AM > To: dev...@li... > Subject: [Dev-C++] FREE download: a HOW-TO use wxWindows with Dev-C++ > > > Dear fellow Dev-C++ users, > > Dev-C++ is a great tool and with its many DevPaks, it is even > more useful. > But sometimes you want to use some C++ library but couldn't > find any DevPaks > for it. You don't really need a DevPak. What you need are the > .a library > file(s) and the C++ header files. If the C++ library comes > with source and > also contains the build scripts, you might be able to create > the required .a > files. This is possible only if the configure scripts are > also built for > MinGW. What follows is an account of one C++ adventure. > > If you want to know how to create the required wxWindows .a > library file for > use with Dev-C++ 4.9.8.0 (GCC 3.2), here's some information for you. > > Download the HOW-TO at this URL: > http://www.yeohhs.com/shareware/wxMSWandDevCppV-1.0.zip > (File Size: 3.4K) > > Best Regards, > Yeoh > -- > P.S. More Free downloads for Dev-C++ users at > http://www.yeohhs.com/free/portal.asp > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: INetU > Attention Web Developers & Consultants: Become An INetU > Hosting Partner. > Refer Dedicated Servers. We Manage Them. You Get 10% Monthly > Commission! > INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Ioannis V. <iv...@em...> - 2003-06-20 02:49:56
|
Ehehe, I agree. :-) Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Mark Livingstone > Sent: Friday, June 20, 2003 3:16 AM > To: dev...@li... > Subject: Re[2]: [Dev-C++] C keyword 'volatile' > > > On Thu, 19 Jun 2003 23:15:23 +0300 Ioannis Vranos > <iv...@em...> wrote: > > > I am sorry but I do not understand what you mean with the above. :-) > > Me either. I think he had been using something else volatile before > posting ;-) |
|
From: Ioannis V. <iv...@em...> - 2003-06-20 02:48:07
|
new whatever[SIZE] is equivalent to malloc(SIZE*sizeof(whatever)), that = is it should boe slower. =20 But better use an std::vector: =20 =20 #include <vector> =20 // ... =20 using std::vector; =20 // ... =20 vector<class_type> array(48); =20 // ... array[0]=3D ... =20 =20 =20 =20 =20 Ioannis Vranos * Programming pages: <http://www.noicys.freeurl.com/> http://www.noicys.freeurl.com * Alternative URL 1: <http://run.to/noicys> http://run.to/noicys * Alternative URL 2: <http://www.noicys.cjb.net/> = http://www.noicys.cjb.net =20 =20 =20 -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Shane = Bryldt Sent: Friday, June 20, 2003 3:39 AM To: C++ Subject: [Dev-C++] Optimized memory allocation Hello, =20 I have recently been attempting to find ways to speed up the process = of loading 48k records from a MySQL SELECT statement, which has a 32 char primary key. One of the more intensive processes involved is calling = "new" to create a new object 48k times. In standard C, I would = malloc(RowCount * sizeof(class_type)), and using pointer math, simply iterate whenever I needed a new structure. With C++, a call to new is required for construction purposes. Is there an optimized method wherein I can = allocate a dynamic number to be preallocated more efficiently all at once in one call? I have considered using "new class_type[RowCount]()" to allocate an array (haven't tried to see if that would actually work), but I was wondering if there was a more efficient means to preallocate objects. =20 Thanks, -Shane |
|
From: Yeoh H. <ye...@ye...> - 2003-06-20 01:53:49
|
Dear fellow Dev-C++ users, Dev-C++ is a great tool and with its many DevPaks, it is even more useful. But sometimes you want to use some C++ library but couldn't find any DevPaks for it. You don't really need a DevPak. What you need are the .a library file(s) and the C++ header files. If the C++ library comes with source and also contains the build scripts, you might be able to create the required .a files. This is possible only if the configure scripts are also built for MinGW. What follows is an account of one C++ adventure. If you want to know how to create the required wxWindows .a library file for use with Dev-C++ 4.9.8.0 (GCC 3.2), here's some information for you. Download the HOW-TO at this URL: http://www.yeohhs.com/shareware/wxMSWandDevCppV-1.0.zip (File Size: 3.4K) Best Regards, Yeoh -- P.S. More Free downloads for Dev-C++ users at http://www.yeohhs.com/free/portal.asp |
|
From: Mark L. <mli...@ip...> - 2003-06-20 01:10:13
|
On Thu, 19 Jun 2003 23:15:23 +0300 Ioannis Vranos <iv...@em...> wrote: > I am sorry but I do not understand what you mean with the above. :-) Me either. I think he had been using something else volatile before posting ;-) |
|
From: Shane B. <ast...@te...> - 2003-06-20 00:38:55
|
Hello,
I have recently been attempting to find ways to speed up the process =
of loading 48k records from a MySQL SELECT statement, which has a 32 =
char primary key. One of the more intensive processes involved is =
calling "new" to create a new object 48k times. In standard C, I would =
malloc(RowCount * sizeof(class_type)), and using pointer math, simply =
iterate whenever I needed a new structure. With C++, a call to new is =
required for construction purposes. Is there an optimized method =
wherein I can allocate a dynamic number to be preallocated more =
efficiently all at once in one call?
I have considered using "new class_type[RowCount]()" to allocate an =
array (haven't tried to see if that would actually work), but I was =
wondering if there was a more efficient means to preallocate objects.
Thanks,
-Shane |
|
From: <or...@vp...> - 2003-06-19 21:31:28
|
Brian Ackermann wrote: > I've been following this thread for a while, as I've had some similar > issues at various points....and now I have a question (rather, I had it > before, and just remembered now to ask it...) > > in the defines you gave > -D_X86_=1 -DWIN32 -D_WIN32 -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ > -D__WIN32__ -DSTRICT -DHAVE_W32API_H -D__WXMSW__ -D__WINDOWS__ > > I see three things that look the same (nearly) > > Whats the difference between > -DWIN32 -D_WIN32 -D__WIN32__ If plunge yourself deep into the wxWindows code (especially into the headers), you'll notice that some of those flags are needed. Some are defined by the others, some are not. Something like: #ifdef WIN32 # define _WIN32 #endif etc. I don't recall exactly, which are defined, which are not. So, it may be true, that not all of them is needed, but perhaps they are all needed. All I know is, that when I removed most flags I could, but still get my program to compile (minimal flags, WIN32 or one of them only, and a lot others removed) resulted in a run time crash. So, I suppose those defines do something good, so I decided to define them all. After all: these flags were digged out by me from the wxWindows MINGW makefiles (makeg95.env), and wxWindows uses these flags for it's sample programs too, so I think they are a must. I am talking about 2.4.0 however, but I don't think 2.4.1 has changed radically in this field... I have played around with it for some time. Maybe you can try different settings too. So, all in all: those defines are essential for a working wxWindows program. Don't ask why! I don't know. All I know, when they are all specified, things work, when not, things crash (but compile). Odd... :) I hope I made things more clear. -- Regards, Balázs |
|
From: alonso r. <alo...@ya...> - 2003-06-19 21:18:26
|
confirm 589829 --------------------------------- Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! |
|
From: Ioannis V. <iv...@em...> - 2003-06-19 20:15:47
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Abhijit Shylanath > Sent: Thursday, June 19, 2003 9:43 PM > To: Dev-Cpp mailing list; Ioannis Vranos > Subject: RE: [Dev-C++] C keyword 'volatile' > > > > IV> "Foo." > PW> "Bar." > AG> "Rainwater harvesting." > Zq> "Labamba." > > Yup, does all of that... and I'm feeling very left-out. > > It also prevents the virtual-memory sub-system from swapping > the variable to > disk, even if it's not used for a very long period of time. Windoze > programmers will have no need for it in this context, though, > since 'doze > won't stay up very long, anyway... no, we should be bothered > more about > fflush()... <scampers off to save data before the next > cra8h39hfhjug=0tuttt... I am sorry but I do not understand what you mean with the above. :-) Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |
|
From: Abhijit S. <mu...@gm...> - 2003-06-19 18:38:21
|
IV> "Foo." PW> "Bar." AG> "Rainwater harvesting." Zq> "Labamba." Yup, does all of that... and I'm feeling very left-out. It also prevents the virtual-memory sub-system from swapping the variable to disk, even if it's not used for a very long period of time. Windoze programmers will have no need for it in this context, though, since 'doze won't stay up very long, anyway... no, we should be bothered more about fflush()... <scampers off to save data before the next cra8h39hfhjug=0tuttt... ________________________________________ Abhijit Shylanath http://mudeth.tripod.com/ |
|
From: <or...@vp...> - 2003-06-19 18:35:34
|
Hello! Hmmm..., now which language should I use? :) No matter, I'll use English, so others can also read it. wxWindows requires a LOT of #defines (or -Dxxx on the command line), which are used by the header files, to provide cross-platformness. The errors you got, were because you didn't actually specify which OS do you compile for. That's why you get errors about case insensitive string-comparison functions, as it is: stricmp() under Windows, but strcasecmp() under Linux (or UNIX?), so wxWindows cannot "find it out". That's why you need to specify the OS, THEN wxWindows WILL be able to "find out" the proper comparison function. So, what flags do you need? Well, you can try digging it out from the original wxWindows distribution's makefile.g95 and makeg95.env and such files, OR you might try using these (my digging :) -D_X86_=1 -DWIN32 -D_WIN32 -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -DSTRICT -DHAVE_W32API_H -D__WXMSW__ -D__WINDOWS__ Tell me if you succed. -- Szervusz! Balázs U.I.: Bocs a késői válaszért, de éppen ma érettségiztem, úgyhogy kénytelen voltam "mellőzni" a gépelést az utóbbi 4 napban. |
|
From: Ioannis V. <iv...@em...> - 2003-06-19 16:23:54
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Louis Godio > Sent: Thursday, June 19, 2003 4:14 PM > To: DEVCppUsers > Subject: [Dev-C++] C keyword 'volatile' > > > Can anyone explain the C keyword 'volatile' > as in the statement: volatile int x; > > What does this do to variable x ? when does one need to use it ? It tells to the compiler that the value of the variable may change by an external factor (e.g. a thermometer) so it can make no assumptions about what its current value is, but always read it when its value is requested. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |
|
From: Daniel K. O. <dan...@ya...> - 2003-06-19 15:22:35
|
Maybe you all would like to give a read on this: comp.lang.c FAQ http://www.eskimo.com/~scs/C-faq/top.html The questions 13.15 ~ 13.20 are about random numbers. Daniel K. O. |