|
Resetting your loop counter variable is the worst thing to do. In this simple example, it might seem all OK to you, but what if there are other routines that will depend on the counter variable after the loop is complete? What if you needed to know how many times the loop executed?
vipin_nvk wrote: Which method is efficient to use? Why?
Just exiting out of the loop with a break would be the ideal way, IMHO. You may use a control variable, as another user pointed out as well.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Is there any way to perform "TOUCH" (like TOUCH in UNIX) in windows, with out installing any tools?
From the site : "http://support.microsoft.com/kb/69581, I came to know that we can use COPY command to perform TOUCH like operation. and tried the below command. but I got the error "The system cannot find the file specified."
system ( "/COPY C:/Documents and Settings/ms56106/.tdm/CookieSession_Details.txt /B +");
So please help to fix this. Below are the different options I tried, but no clue.
1) I Have executed the below command from command prompt it works fine.
C:\Documents and Settings\ms56106\.tdm> COPY /B "C:/Documents and Settings/ms56106/.tdm/CookieSession_Details.txt" +
1 file(s) copied.
And if try the same from different folder it fails,
C:\Documents and Settings\ms56106> COPY /B "C:/Documents and Settings/ms56106/.tdm/CookieSession_Details.txt" +
The system cannot find the file specified.
0 file(s) copied.
What should I do to run for a different folder?
2) I want the same command to be used in C++ source, for this I tried the same with system(), but it is not working. Please correct me.
tem = C:/Documents and Settings/ms56106/.tdm/CookieSession_Details.txt
system ( "/COPY tem /B +");
Thanks,
Nandu
|
|
|
|
|
I'm suddenly having Déjà vu[^], I believe that I've read this post before.
|
|
|
|
|
|
i am a new C++ programmer and would like to implement an array based list for 100 integers and would also want to sort them by any integer of my choice.
snyboy with an with an idea on how to go about this?
phokojoe
|
|
|
|
|
for the array what about :
int myArray[100];
or (way better, easier for sorting)
std::vector<int> myVector;<br />
myVector.reserve(100);</int> // optional
|
|
|
|
|
Maximilien wrote: int myArray[100];
or (way better, easier for sorting)
std::vector myVector;
myVector.reserve(100); // optional
Why do you think sorting a std::vector is easier?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Why do you think sorting a std::vector is easier?
because someone though of writing the std::sort() algorithm maybe...?!
|
|
|
|
|
someone else possibly though of writing qsort
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Yes, but std::sort() algorithm is faster than qsort!
A C++ programming language novice, but striving to learn
|
|
|
|
|
I have a cmak (connection manager administration kit) dll. Two of it's functions are called when you do Start > Connect To > [the name of the connection]. (custom pre-connect actions) Is it possible to receive windows messages in a dll? I've tried creating a VS2005 Win32 Console Application, opting for a Windows Application, and then just took the code from the main cpp file and entered into the main dll file. But CreateWindow(...); returns an invalid handle indicating that it was not succesful in creating the window. I got the dll project from
C:\Program Files\Microsoft Platform SDK\Samples\NetDS\Ras\ConnectionManager
It's a converted VS6.0 project. (.dsw) All windows message recieving examples I've seen are .exe projects. They say in the help file of cmak that you should implement WM_PAINT in your dll if your pre-connect actions takes a lot of time, which it does. This is a windows message so I thought what they meant was that you have to trap this message. But to do that you need a window (visible or invisible) right?
|
|
|
|
|
Just a guess here, but how about running a message loop in your DLL, i supose the loading/working of the DLL is done from the GUI thread of ...whatever it using the DLL and thus if the DLL takes a long time to finish the GUI of the app becomes unresponsive and "unrefreshed". So i guess what you should do is to run the message queue in your DLL while the processing is being done.
So while your DLL is not done, do something like this:
MSG Msg;
while (GetMessage(&Msg, NULL, 0, 0))
{
if (!TranslateMEssage(Msg)) DispatchMessage(Msg);
}
Of course you somehow need to exit that loop once your DLL is done, but how you do that is up to you. Could also be that you need to filter out WM_PAINT messages from the queue and only dispatch those.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Hi,
I want to create a HTML like interface using vc++.
I have heard about vc++ using xaml.
Is this best way to do or any other opton is there.
Please suggest me and give me some link related your suggestion.
|
|
|
|
|
hi all,
when i execute application than its take some memory i check it from task manager.
when without closing wizard on click on back and next button the application memory usage inccrease.
please tell me how can i solve this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Are you cleaning up after yourself ?
Are you making sure the memory you allocate is properly de-allocated ?
This signature was proudly tested on animals.
|
|
|
|
|
please tell me.How can i cleanup?
i cant understand where i can allocate memory or where i can deallocate memory.
i m simply use diffrent type of control like Edit,Text,DatetTime,Check Box,RadioButton,Group-Box,List,Combo-Box.and add there corresponding variables.
please help me.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
I believe (and I've been proved wrong numerous times) that when using a "wizard" the different UI pages are created as you go to them, but not destroyed as you leave them, so you application "might" grow in size, but not actually shrink.
but does that matter that much ?
This signature was proudly tested on animals.
|
|
|
|
|
yes , now what can i do?
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
"_$h@nky_" wrote: now what can i do?
Maybe answer why you're so concerned about what task manager is telling you?
Your job is to make sure you free any resources you explicitly allocate.
Let the OS manage the rest after that. There's often no need for the system to return
freed memory to the system unless it's needed, assuming you've actually properly released
resources you're no longer using.
The task manager is NOT a debugging tool!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have a CBitmap object and want to save it as a file .
Please help me how to achieve it.
Thanks & regards.
Dhiraj
|
|
|
|
|
Starting from CBitmap (MFC) or a GDI HBITMAP (what MFC wraps) it's not so easy:
A sample is on MSDN http://msdn.microsoft.com/en-us/library/ms532340(VS.85).aspx[^]
Otherwise, cosider using GDI+, where all this stuffs are wrappen in the Gdiplus::Bitmap class that can be created from an HBITMAP.
(but you have to link for GDI+ libraries and run startup/termination appropriately: just llok GDI+ under MSDN)
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
You may use CImage class [^], check out the CImage::Attach method.
I suppose (I didn't test it) the following code will do the trick:
CBitmap myBmp;
CImage myImg;
myImg.Attach(myBmp);
myImg.Save(_T("my.bmp"));
myImg.Detach();
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Its giving assertion related to size.
|
|
|
|
|
Dhiraj kumar Saini wrote: Its giving assertion related to size.
This is not a good way of getting help. You should be more precise and detailed when reporting errors.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Did you trace it ? and can you show your code?
|
|
|
|