|
simple answer : yes.
There are no build-in calculus functions in C++.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Book:
NUMBERICAL RECIPES in C Th Art of Scientific Computing
Cambridge University Press
ISBN 0-521-35465-X
Is probably they place to start if you plan on writing your own; Otherwise you'll need to find and purchase a library (recommended).
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi,
I need to open a file and appened to it later, from some reason, it get's overwritten, here is the most simple code....
<br />
<br />
CStdioFile log_file (_T("file.txt"),CFile::modeWrite |CFile::modeCreate |CFile::typeText);<br />
log_file.WriteString("123\n");<br />
<br />
CStdioFile log_file (_T("file.txt"),CFile::modeWrite |CFile::typeText |CFile::modeNoTruncate);<br />
<br />
log_file.WriteString("456\n");<br />
end result in the file is always "456".
Why????
|
|
|
|
|
try to use retrived handle in fopen function with a+ flag instead of recalling constructor
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
I don't want to use fopen etc....
The reason why I started using CStdioFile is because Visual Studio .NET did not support the <fstream.h> anymore
|
|
|
|
|
use CreateFile!?
it always help me with)
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
CFile::modeNoTruncate Combine this value with modeCreate. If the file being created already exists, it is not truncated to 0 length. Thus the file is guaranteed to open, either as a newly created file or as an existing file
Artificial intelligence is no match for natural
stupidity.
|
|
|
|
|
So....
You suggest to change the second time I open the file to:
<br />
CStdioFile log_file (_T("file.txt"),CFile::modeWrite |CFile::typeText ||CFile::modeCreate |CFile::modeNoTruncate);<br />
I already tried that, just like the the microsoft site say, still no change, this is crazy, I know.....
|
|
|
|
|
Ah yes... stupid of me... you have to SeekToEnd() before you write again
Artificial intelligence is no match for natural
stupidity.
|
|
|
|
|
Here's whay I do and it works everytime.
<br />
CStdioFile myFile;<br />
myFile.Open (FileName, CFile::modeCreate | CFile::modeReadWrite | CFile::modeNoTruncate, NULL);<br />
myFile.SeekToEnd();<br />
myFile.WriteString (strLSbuf);<br />
myFile.Close ();<br />
I think the problem you are running into is that you are not first placing the cursor to the end of the line then writing out your string.
So when you do an open on the file, the cursor is placed at the beginning of the line and you overwrite your existing data.
Hope this help
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
AAAAAnnnndddddd.... we have a winner !!!
Thanks a lot.
When I worked with ofstream, and use the ios::app flag it was done by default I guess.
Have a great day.
|
|
|
|
|
Hi all:
I have the declaration like this:
CString strTM
std::map<int, std::string> TMMap;
TMMap[0] = "Readed";
But when I access through the key value like this
strTM= TMMap[0];
the compiler give me a error Message like this
"binary '=' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char="">"
Why? How can I fix this problem.
|
|
|
|
|
Hi All,
I have a Dialog with a text box. I want to draw some drawing in the Editbox using GDI ( Say simple lines using LineTo() and MoveTo() ). Can anyone help me what should i do for that.
Thanks in Advance.
|
|
|
|
|
1)You can derive a class from CEdit and Handle OnPaint(). You will have dc their. YOu can use it to draw like dc.MoveTo() - dc.LineTo().
2)Or you can call CDC* pDC = CEdit.GetDC();
pDC->MoveTo(), pDC->LineTo().
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
DELIVER THE PROMISE wrote:
Or you can call CDC* pDC = CEdit.GetDC();
pDC->MoveTo(), pDC->LineTo().
Thanks man . That is easy to follow and working.
|
|
|
|
|
Hi,
Pls guide me the way to find a Active or Highlighted or Default Button in a given Window.
Or atleast need to enumerate all controls/buttons in a given window .
Thks,
Sureei
|
|
|
|
|
|
Usintg the PreTranslateMessage to obtain and process keyboard input but all the normal keys I process seem to be upper case (e.g. pMsg->wParam, seem to be ASCII upper case) even when I change the Caps Lock.
ARe they a flag that controls the case?
grahamfff
|
|
|
|
|
There are no such things as lower case keys on the keyboard. All keys are defined by a VK_xx value eg. VK_A thru VK_Z for A-Z. See winuser.h
To handle character case you need to check if the Shift Key is down or Caps Lock is on. For the shift key use:
if ( GetKeyState( VK_SHIFT ) & 0x8000 )
...;
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Hi Guys
anyone have a clue where i can download the ddk with out being a msdn subscriber(too expensive for a student) and not paying 25 $ for shipping. Please help. I'm working on a kernel mode driver, but for this i need the DDK.
MFG
RedDragon2kx
Unix and C are the ultimate computer viruses.
|
|
|
|
|
Hi,
I am doing GUI programming using Win32 SDK (no MFC). I have a dialog box with 2 text fields, 2 static (labels) and 2 buttons. I wish resize the dialolg box and move / resize the 6 controls on it. Can anyone suggest how to get handles to all the 6 child windows to do SetWindowPos for each?
I have tried using GetWindow with GW_CHILD and GW_HWNDNEXT. However I can get only the text boxes on the dialog box. Moreover, I have noticed that the while loop to enumerate child windows goes into infinite loop.
Please suggest some solution.
|
|
|
|
|
if u have command identifiers of each control you can use GetDlgItem to get handle.
if u dont - then enumarate windows using FindWindow+FindWindowEx
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
What about EnumWindows and EnumChildWindows?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
Thanks for the replies. I finally managed to achieve the functionality using GetWindow itself. The problem was, I initially did a SetWindowPos immediately after acquiring the window handle to the child control. This changed the Z-order of the windows and because of which it went into infinite loop.
I have now implemented following solution:
1. Collect all the child window handles in a container such as list<hwnd>
2. Iterate through the list applying the modifications to each of the window using the window handles. This iteration has to be done using reverse_iterator. I suspect that this is essential because the first child of the parent window is the control with highest tab index, or highest Z-order. So to maintain the tab order, one has to do reverse-iteration. [Kindly confirm ]
Rgds,
Mandar
Wish you all a Very Happy New Year!
|
|
|
|
|
Hi all:
In the following code, after the TrackMouseEvent() call, does it means don't send WM_MOUSELEAVE message?
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.hwndTrack = m_hWnd;
tme.dwFlags = TME_CANCEL | TME_LEAVE;
tme.dwHoverTime = 1;
_TrackMouseEvent(&tme);
and after
tme.cbSize = sizeof(tme);
tme.hwndTrack = m_hWnd;
tme.dwFlags = TME_LEAVE | TME_HOVER;
tme.dwHoverTime = 1;
_TrackMouseEvent(&tme);
does it means send WM_MOUSEHOVER and WM_MOUSELEAVE message? if so, then what about the ordinary WM_MOUSEHOVER and WM_MOUSELEAVE, Are they not function at all?
|
|
|
|