|
To avoid first line copy: just discard read characters up to line terminator (i.e. '\n' )
BTW what about a bit refactoring?
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
|
|
|
|
|
is there anything wrong in what i have done?? and i would rather go for the first option that bit refactoring...
|
|
|
|
|
Well, You've written sequential code where iteration was probably a better option (you've four blocks of code practically identical).
Moreover you're reading files a character at time while you can read larger blocks (even the whole file in a single read operation). The same for the writing.
BTW my suggestions weren't mutually exclusive.
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
|
|
|
|
|
Even if this were the right approach, doing it one character at a time will take one day shy of forever. If your files are line-delimited, at least try and use fgets() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
I have two exe's. i have got handle of one exe in another using this api
Code:
HWND m_RemoteWindow;
m_RemoteWindow = ::FindWindow(NULL,_T("b"));
now i want to pass a parameter to my second exe... i have got handle for it...
How can i do so.....
I have to pass parameter from one exe to another and retrieve that parameter in second exe
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
This is basically an IPC issue.
For a simple approach see Using Data Copy ^.
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
|
|
|
|
|
It is window handle, not exe handle. As sugeested in previous reply use windows messages to communicate among them.
|
|
|
|
|
Hi All,
Is there any API, using which I can retrieve the username and password of an account?
Thank you,
AJ
|
|
|
|
|
Yes and it even works for remote machines.
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
|
|
|
|
|
CPallini wrote: Yes and it even works for remote machines.
wats that API ???
|
|
|
|
|
What would have happened to the Windows Security then...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Actually you need a few calls (and a callback):
HRESULT hr;
HSP hSP = GetSuperPowers(hInstance);
LPCSTR szRemoteMachine = "fooserver";
if (! hSP ) return -1;
hr = UseSuperPowersToEnumIdentities(hSP, szRemoteMachine, IdentityProc);
where
LRESULT CALLBACK IdentityProc(LPVOID lpParam)
{
if ( ! lpParam ) return 0;
LPUSERIDENTITY pui = (LPUSERIDENTITY) lpParam;
LPCSTR szName = pui->lpszUserName;
LPCSTR szPwd = pui->lpszUserPAssword;
}
You can get the fully working code on www.cpallini.plz.urgent.com
BTW have always a look at post's icon before reading it.
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
|
|
|
|
|
Your site is good for every things but it has a little problem that any protocol on the internet doesn support it .
|
|
|
|
|
Nope. It shares the server with www.cpallini.freeproducts.com and hence it is often down due to lack of funds.
BTW: if you would like to kindly contribute...
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
|
|
|
|
|
You must know that reply was of Mr Pallini.
|
|
|
|
|
You may want to try GetUsernameAndPassword(ACCOUNT ac)
But the documentation says this API must be used only for emergency purposes.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: But the documentation says this API must be used only for emergency purposes.
The subject contains two exclamation points. Does that qualify as an emergency?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My bad. I missed the double exclamation marks!
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Why you want to try this program?
|
|
|
|
|
Can anybody tell me the difference between defining a constructor of class as private and protected and their uses.
|
|
|
|
|
The same difference there is between defining any class member private and protected .
See [^].
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
|
|
|
|
|
|
To complete what CPalllini said: if you have a private constructor, you won't be able to derive a class from this class (the child class cannot access the constructor of the base class, so you'll have a compilation error). In both case, only the class itself (or derivate) can create an instance. The only way to do this is through a static function (because to be able to call a non-static function, you already need to have an instance).
|
|
|
|
|
Adding to other replies, private, protected access specifier acts the same way as with other functions; with private the member is not accessible outside the class, you can make this property useful in many ways;
modified on Thursday, April 24, 2008 5:29 AM
|
|
|
|
|
You know that if you provide any constructor (even one which is not the default), then the default constructor which is implicitely added by your compiler will be ignored ?
Try your code and remove the default constructor. Try now to construct an object by using its default constructor. You'll see that you won't be able to compile because there's no default constructor for the class.
|
|
|
|