|
Have you tried something like:
while (myfile.good())
{
myfile.getline(line, sizeof(line));
wcout << line << endl;
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
I just tries it changing line 's tpye to
WCHAR* line;
But now the pogram does nothing.
It doesn't even show the line numbers anymore.
I used breakpoints and looks like myfile.good () always returns false .
|
|
|
|
|
Megidolaon wrote: WCHAR* line;
Are you allocating memory for line ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
I just changed it to
WCHAR line[2000]; then to
WCHAR* line = new WCHAR; and finally to
WCHAR* line = new WCHAR[]; The program still does nothing in all cases.
|
|
|
|
|
Why not just leave it as:
wstring line; That way you don't have to be concerned with allocating too little or too much memory.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
I had that first, but then the string remains empty and never gets filled.
No matter how I do it, the program doesn't ouput the content of the files.
|
|
|
|
|
Hello,
I have a CStatic on CMDIChildWnd but I am not able to change its background color.
I have tried using CWnd functions
CStatic* Static = new CStatic;
CDC* pDC = Static->GetDC();
pDC->SetBkMode(OPAQUE);
pDC->SetBkColor(RGB(150,150,255));
Pritha
|
|
|
|
|
Handle the WM_CTLCOLORSTATIC notification and return the brush to be used to paint the control.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
First of all, in your piece of code you have instantiated a CStatic object but have not created a static control (see CStatic::Create).
And BTW: where/why do you want to put a static control in the MDI child frame window?
Ovidiu Cucu
Microsoft MVP - Visual C++
Cofounder CODEXPERT.RO
|
|
|
|
|
thanks
Yes I do have the Create function.
How do I use WM_CTLCOLORSTATIC ?
Should I call the OnCtlColor() ?
Thanks
Pritha
|
|
|
|
|
No.
It will be called by the system while initializing the controls.
You simply have to return the appropriate brush from the message handler.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
You need to declare this event.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Thank you
It helped me a lot.
|
|
|
|
|
Hello,
There was a query on the same lines.I am many a times confused which are the fucntions that are called by the system automatically which are not.
Now in this case why the creation of CStatic calls OnCtlColor().
Thanks,
Pritha
|
|
|
|
|
Again you dont need to call OnCtlColor.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hello,
I wanted to understand the functions that are directly called by the system and the reason behind it.
Prithaa
|
|
|
|
|
We suppose you made a program Windows send messges to your program if you need to these messages you can declare events for them like WM_MOUSE* or WM_PAINT and etc.You dont need to call windows events because windows sends them to your program for exmaple you need to change color of a static control so you tell to Windows that I need to this event with declare this event.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hello,
Thanks for the reply.
but how do I know exactly which functions are called by the system an which ones I am suppose to call. is there any article which makes this clear.
Prithaa
|
|
|
|
|
You can see them on the MSDN for example if you enter WM_COPYDATA on the MSDN you will be see "This message is sent when an application passes data to another application" or WM_INPUT "The WM_INPUT message is sent to the window that is getting raw input."
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I want to read the file while downloading through the ftp client before download complete I got the error (The file is already in use. Close other programs that might be using the file, or stop playing the file, and then try again).
when I download the same file throught the window explorer by ftp I am able to read the file before download complete. My project requirement is to read some file content before download complete .How can I achieve that .
|
|
|
|
|
That is a big question. You should give more details i believe. Did you write the FTP downloader part yourself? How did you create/open the file for writing (the one you are downloading)?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Yes I write the FTP downloader part myself. I am uing CInternetSession ,CFtpConnection class to download the file and use the function FTPConnection->GetFile(LPCTSTR pstrRemoteFile,
LPCTSTR pstrLocalFile, BOOL bFailIfExists = TRUE,
DWORD dwAttributes = FILE_ATTRIBUTE_NORMAL,
DWORD dwFlags = FTP_TRANSFER_TYPE_BINARY,
DWORD_PTR dwContext = 1
).
I am downloading wmv file and while downloading I want to play on windows mediaplayer.
|
|
|
|
|
As you can see here[^], looking at the flags (especially CFile::shareDenyRead) you can guess that CFtpConnection::GetFile probably creates the target file denying read (and also probably write) access to it, so if you try to play the file in the player, the OS won't allow it to open the file. I have currently no idea how you could change the sharing-mode CFtpConnection uses to create the file.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Is there another API to download the file from the FTP to solve my above problem.
|
|
|
|
|
Well, am not sure about that, but This[^] looks promising, and you get source code with it too so you can shape it the way you want.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|