|
Anonymous wrote:
If I have to do this, how does printf() avoid it?
The format string given to printf() implicitly says how many parameters should be there. For your average() method, there is no way the method can tell how many parameters are there, so the terminator is required.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Anonymous wrote:
If I have to do this, how does printf() avoid it?
It probably uses vsprintf I
f there is a format specifier. e.g. printf("%d %d", 42, 53) you can easily work out the number of argumenst required, you must make the assumption they are all present though.
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
Anonymous wrote:
If I have to do this, how does printf() avoid it?
printf() avoids it by not caring. It assumes that you are passing the same number of args as there are option switches in the format string. If you don't, printf() might crash.
So what can you do? There are basically two choices:
- Add a count parameter to your function:
int average( int first, int count, ... )
- Do what the MSDN example does, and supply a terminator value.
p.s. Thank you for taking the effort to format your question.
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
Hi,
I've a .net project and I need to convert it to VC6.0 how do I do it !!
Ciao
- Nilesh
|
|
|
|
|
|
I declared a CFont object and a CIpAddressCtrl object in the header of CWnd -based class
CFont m_Font;
CIpAddressCtrl m_IpAddress;
In the Create method of this class I created font and set it to the CIpAddressCtrl object.
m_Font.CreateFont(...);
m_IpAddress.SetFont(&m_Font);
After destroy my class Numega's BoundsChecker tell me about Invalid Argument: DeleteObject. Why?? If I use other control instead CIpAddressCtrl (tested with CComboBox and CEdit ) then all OK.
Best regards,
Eugene Pustovoyt
|
|
|
|
|
MSDN says: "When you finish with the CFont object created by the CreateFont function, first select the font out of the device context, then delete the CFont object."
You could call m_Font.DeleteObject() in the dtor of the CWnd class.
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
In a case with the chosen font in CIpAddressCtrl DeleteObject results to the same error.
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Hi all
i hope that this time i am here with an easy question.
i have a DLL in this DLL i have used WndProc and GetMessage along with Journal Record Hook, in this LL i am generating function code. by function code i mean that the user interactions are saved in the form of functions. lets say that i have a comboBox and a user selects an item from this. i would generate a Combo_Select_item in my DLL and this entry is being wrriten to a simple text file.
now that i am integrating this code in to a driver program which is a an SDI application i want to past this generated code to the workspace of the SDI driver application i mean as the code is generated in the DLL simultaneously it should be pasted in the SDI workspace has any one done this stuff if so please do tell me this time i am badly needing this i u have any furthur queries post it
thanx in advance for ur time
regards
Basim
|
|
|
|
|
Hi All,
i have an application which opens a web browser. I want to open all the new window events to cause open the same URL in parent window so that no new window is open, and the contents are also displayed. I can trace and stop the user from opening new window but..that causes..no new window and no contents of the URL displayed so I m stuck there..whilst i want user should browse and get the contents but he cannot open new window............Please help...
Any help or pointers are highly appreciated....Thanks a lot in advance..
Himanshu
|
|
|
|
|
NetWkstaUserGetInfo shows you the current user logged in the workstation. Maybe you need to update your SDK.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Thanks for your answer, but i am using SDK Feb. 2003. The SDK documentation says, that...
The NetWkstaUserGetInfo function returns information about the currently logged-on user. This function must be called in the context of the logged-on user.
I tried to use this function in a differnt user context...
|
|
|
|
|
I am sorry, I wasn't very sure about your question. I really cannot be of much help but have a look at NetWkstaUserEnum. I have never used this function but I just came across it.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Hi,guys
i have got a big problem getting the currently logged on user (WinSta0\Default). There are some functions like GetUserName(Ex) and NetWkstaUserGetInfo, but they show only the user of the current process. My problem is, that i am using a service running under local Admin and want to know who or if somebody is logged on.
Thank you very much
Dirk
|
|
|
|
|
Hi
Can anybody tell me where can i download msdn 2003. I remember reading a post on this but could not find it.
Thanx
|
|
|
|
|
http://download.microsoft.com/download/b/d/c/bdccea1b-96d9-4ad9-8045-56619af95835/qtr40enud1.img
http://download.microsoft.com/download/b/d/c/bdccea1b-96d9-4ad9-8045-56619af95835/qtr40enud2.img
http://download.microsoft.com/download/b/d/c/bdccea1b-96d9-4ad9-8045-56619af95835/qtr40enud3.img
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
thanx
|
|
|
|
|
You're welcome.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Great, maybe I should download them also
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
how do i make one behave as a checkbox without adding a checkbox control?
|
|
|
|
|
m_wndToolBar.SetButtonStyle(1, TBBS_CHECKBOX);
where 1 is the index of the button in the toolbar and m_wndToolBar is a CToolBar.
Cheers,
Fredrik
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Is there any way, by which I can add my menu to system menu.So that whenever use right clicks on any application/item,my menu get open along with other system menus like copy,paste..
|
|
|
|
|
Take a look on Context Menu Shell Extensions and IContextMenu. You could find a number of articles at this site.
|
|
|
|
|
Hi,
How do i convert a byte array to a bitmap and save it as a jpeg bitmap on the disk.
I have written a MFC application.
Can anyone help me in this.
Thanks,
peenu.
|
|
|
|
|
[rant]
OK, this is really bugging me . Why doesn't the vector class have a remove(int) method? Why does it insist on doing everything with these damn "iterators"? No wonder I hate STL!!
[/rant]
What is the best way to remove an element by index from the middle of a vector? At the moment I'm doing this:
int nElementToRemove = 5;
vector<type>::iterator it = myvector.begin();
while(nElementToRemove--)
it++;
myvector.erase(it); But surely there must be a better way. Does anyone know of the best way to do this?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|