|
do i have to
#include anything to use the innertext, outertext etc etc?
|
|
|
|
|
They are methods of the IHTMLElement interface. You might need to include mshtml.h .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
#include <iostream>
#include <fstream>
using namespace std;
int main() {
fstream file("c:\\test.txt",ios::in | ios::out | ios::binary);
if(file.is_open())
{
file<<"Hello";
file.close();
}
else
{
cout<<"Error";
}
return 0;
}
I wonder why this code is giving me the output "Error" unexpectedly...what went wrong in this code. I'm not able to write texts in file..please help
|
|
|
|
|
As you may check, opening the file with ios::in flag set, fails if the file doesn't exist.
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]
|
|
|
|
|
Member 6910300 wrote: I'm not able to write texts in file..please help
Does the file exist?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
no the file is expected to be created.
in the following case also it outputs "Error"
fstream file("c:\\test.txt",ios::out | ios::in);
if(file.is_open())
{
file<<"Hello";
file.close();
}
else
{
cout<<"Error";
}
|
|
|
|
|
Then you should use:
ofstream file("c:\\test.txt", ios::binary);
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
thanks for the answer but i dont want to use ofstream and ifstream class instead i want to use fstream class only. Is it possible? and i also need the file to be created as using ofstream.
|
|
|
|
|
if the file does not exist, you have to use
fstream file("c:\\test.txt", ios::out | ios::binary);
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]
|
|
|
|
|
what's problem with this bit masking
ios::in | ios::out | ios::binary
since we have specified out in the mask, why the file is not being created.
thanks for replying.
|
|
|
|
|
The problem is you can't read from a not exitsting file, I suppose.
Your bit mask works if the file do exist. On the other hand, if the file does not exist you should use the
ios::out | ios::binary
mask.
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]
|
|
|
|
|
maybe your file doesn't exist.check your file. I check your code, is ok.
Calvin
|
|
|
|
|
Hi,
I am using ON_WM_KEYDOWN event for keyboard shortcuts in my application. And below is function to handle this keydown action.
void CRearPanel::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(nChar == 112)
{
if(((CMainFrame*)AfxGetMainWnd())->GetRearPanel()->m_hWnd != NULL)
((CMainFrame*)AfxGetMainWnd())->GetRearPanel()->ShowWindow(SW_HIDE);
if(((CMainFrame*)AfxGetMainWnd())->GetHWSimulatorDlg()->m_hWnd != NULL)
((CMainFrame*)AfxGetMainWnd())->GetHWSimulatorDlg()->ShowWindow(SW_HIDE);
}
else if(nChar == 113)
{
((CMainFrame*)AfxGetMainWnd())->OnViewHWSimulator();
if(((CMainFrame*)AfxGetMainWnd())->GetRearPanel()->m_hWnd != NULL)
((CMainFrame*)AfxGetMainWnd())->GetRearPanel()->ShowWindow(SW_HIDE);
}
else if(nChar == 114)
{
((CMainFrame*)AfxGetMainWnd())->OnViewRearpanel();
::SetFocus(((CMainFrame*)AfxGetMainWnd())->GetRearPanel()->m_hWnd);
if(((CMainFrame*)AfxGetMainWnd())->GetHWSimulatorDlg()->m_hWnd != NULL)
((CMainFrame*)AfxGetMainWnd())->GetHWSimulatorDlg()->ShowWindow(SW_HIDE);
}
CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
}
Now let me explain my problem,
Here I am having one main document window which is coming up initially. And I have another 2 dialog window which should be open on keydown event. From main document window I am able to get key down event and functionality working properly. In Those 2 dialog I put same events, and there start my problem. First time when it(dialog) comes up its not catching keydown event. If I close that dialog and then open it again then I am able to catch it. I found on net some where to put below code,
BOOL CRearPanel::PreTranslateMessage(MSG* pMsg)
{
if( pMsg->message == WM_KEYDOWN )
{
::TranslateMessage(pMsg);
::DispatchMessage(pMsg);
return (1);
}
return CDialog::PreTranslateMessage(pMsg);
}
But I dint find it helpful. Can any one help me for this issue.
|
|
|
|
|
Do you want the dialogs to execute anything when key down?
or..
Is the parent window the one that has to execute anything on the key down from dialog?
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
well currently I have set same shortcut action in main window and 2 dialog. I mean for all window action for F1 F2 F3 should be same. I thought of passing action msg to main window back, but for that also those dialog should get event..
Is there any work around?
modified on Tuesday, February 2, 2010 10:33 PM
|
|
|
|
|
Hi i think i got the problem. But I dont know how to solve it. Here the dialog I am talking have internally different dialog attached into their body. So focus is not fixed sometimes its that in main dialog sometimes in child dialog. Is there any way that for 3 keys F1, F2, F3 took event in mainframe or main application class. I dont want to pass this 3 key down event to any further dialog,
|
|
|
|
|
|
You were not bothering, and sorry about the absence (I was pretty busy last days).
Glad that you found a solution
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
friends,
plz reply this question.
thanks
|
|
|
|
|
Already asked, at least in the Quick Answers [^](and you got some answers...).
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]
|
|
|
|
|
why do u need for google APIs?
Failure is Success If we learn from it!!
|
|
|
|
|
The Google Maps API have a lot of practical applications, not the least of which is just to learn how it works. To question someone's need for that seems silly.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Well, this is your third time doing this question, and you don't even bother in changing such a lazy content.
In one [^] of them you got an answer from Christian Graus and, in the second one[^], you got an answer from me.
Instead of asking another time, why the hell don't you take a look in your previous questions?
If you continue like that, I bet that you will not end nicely.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hello,
What is the exact way to find the export and import sections from PE file?
Regards
Muhammad Usman Khalil
modified on Tuesday, February 2, 2010 5:19 AM
|
|
|
|
|
See possible answers here[^].
MVP 2010 - are they mad?
|
|
|
|