|
|
You can quickly get the system up time by calling GetTickCount() , however, this has the caveat that the time is stored in a four-byte integer. Consequently, the time rolls over after 49 days and change. I know that Windows 2k has a performance monitor that provides this, but I haven't taken the time to look up how to access it.
Jon Sagara
What about ?
|
|
|
|
|
C:\My Documents\DataStru\main.cpp(147) : fatal error C1004: unexpected end of file found
can anyone tell me how to fix this ?
please
|
|
|
|
|
check for all { and }
All of them should have equal numbers
Mazy
|
|
|
|
|
Did you include the stdafx.h header file in main.cpp?
|
|
|
|
|
You might have to change your project settings so that you're not using precompiled headers for main.cpp. If you want to use precompiled headers, then make sure you have included stdafx.h (as previously mentioned).
Jon Sagara
What about ?
|
|
|
|
|
I'm having a logic problem or something but i'm just not seeing it
I am relaying data using an 16k buffer, but the data gets corrupted. Here is an oversimplified example of whatI'm doing:
*pseudocode*
buffersize = 0;
while(other condition)
while (buffersize != 16386)
{
read = 0;
read = sock.read(data, 2046);
memcpy(bigbuff+buffersize, data, 2046);
buffersize += read;
}
memcpy(data, bigbuff, 2046);
buffersize-=2046;
memmove(bigbuff, bigbuff+2046, buffersize);
}
that pretty much covers it, thanks for your help.
<b>S</b>tephen <b>C</b>aldwell
Blackfission, CEO
http://blackfission.myip.org:81
|
|
|
|
|
16386 isn't a multiple of 2046. buffersize is probably getting larger than what you can handle. Change that to while (buffersize <16386)
--Mike--
"Everyone has figured out what 'service pack' really means, so they had to go and change the language. Perhaps this is what Bill was talking about in the 'security is top priority' letter."
-- Daniel Ferguson, 1/31/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
while (buffersize != 16386)
{
read = sock.read(data, 2048);
int appenLen = (read+buffersize) > 16386 ? : (16386-buffersize) : read;
memcpy(bigbuff+buffersize, data, appenLen);
buffersize += appenLen;
}
|
|
|
|
|
Kinda helped a little.
Stephen Caldwell
Blackfission, CEO
http://blackfission.myip.org:81
|
|
|
|
|
The pseudocode i posted was actually nothing like what my actual code was
Here is the actual code(relevant parts):
#define BUFFER 2046
#define BIGBUFFER 16368
int buffersize = 0;
int read;
while (buffersize != BIGBUFFER)
{
if ((BIGBUFFER - buffersize) >= BUFFER)
read = m_pSource->ReceiveChar(buffer, BUFFER); //read the data
else
read = m_pSource->ReceiveChar(buffer, BIGBUFFER-buffersize);
memcpy(bigbuffer+buffersize, buffer, read); //copy data to buffer
buffersize += read; //update buffer size
}
//Set the data in the buffer to be sent
buffersize -= BUFFER;
memcpy(buffer, bigbuffer, BUFFER);
memmove(bigbuffer, bigbuffer + BUFFER, buffersize-1);
//Send out data
}
<b>S</b>tephen <b>C</b>aldwell
Blackfission, CEO
http://blackfission.myip.org:81
|
|
|
|
|
mfc dialog based, there's an edit box, and a button.
the button has to do 2 things, 1: check the edit box for text 2: if text copy the text to the messagebox. here's the code for the button, tell me what i'm doing wrong please.
void CMyDlgDlg::OnShow()
{
if (WM_KEYDOWN)
{
GetDlgItemText(IDC_TEXT,m_sText);
MessageBox(m_sText,"Sample Dialog
Box",MB_OK);
}
else
{
MessageBox("test","hmm",NULL);
}
}
|
|
|
|
|
Instead of overriding OnShow(), you should write a handler for the button click event. Add the handler using ClassWizard. The handler should do this:
GetDlgItemText (IDC_TEXT, m_strText);
m_strText.TrimLeft();
m_strText.TrimRight();
if (!m_strText.IsEmpty()) {
AfxMessageBox (m_strText);
} /ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
i got it working with your code. i'd like to get it to clear the edit box when the messagebox closes but i've tried putting the updatedata everywhere and the only place it makes a difference is before evreything else. but that seems to cancel out entering text so you always get a warning. anyhoo it's no biggy. thanx for the help!!
|
|
|
|
|
To clear the edit box, insert this line after the call to AfxMessageBox().
SetDlgItemText (IDC_EDIT, ""); /ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi.
The spring semester began at my college this week. I registered for a "special" class that is not about learning C++, but it is about working in teams to solve problems using C++. We enter into competitions statewide against other universities. So this is a pretty serious journey I am traveling.
We code in the UNIX environment. I have had previous experience with Linux including Red Hat and Debian. I do not have problems managing the OS. However, I have been using Visual C++ 6 and .NET only. I began using UNIX vi C++ editor this week. It is quite easy, but is tedious when it comes to coying and pasting.
Anyways, what is the best UNIX C++ editor?
Thanks,
Kuphryn
|
|
|
|
|
kuphryn wrote:
Anyways, what is the best UNIX C++ editor?
Visual Studio and WS_FTP.
Jon Sagara
What about ?
|
|
|
|
|
Trying to start a religious war? OK, Emacs is the One True Editor.
|
|
|
|
|
Hey, thanks guys.
I program strictly in UNIX command and not XWindow. I am currently using vi, which I am used to now.
As I said above, I come from a Visual C++ environment. Even now I still prefer Visual C++ because it is easier to move around, modify specific code at specific sections because of the mouse.
What does emac has that vi does not? The programming professor/leader of the team recommend emac over vi. He said emac can emulate vi.
Lastly, why do developers prefer UNIX over NT environment? I find the UNIX environment (non-XWindows), primitive. Everything takes time including typing in long commands.
Kuphryn
|
|
|
|
|
kuphryn wrote:
As I said above, I come from a Visual C++ environment. Even now I still prefer Visual C++ because it is easier to move around, modify specific code at specific sections because of the mouse.
If you can FTP to your Unix box, then you can still use VS.
kuphryn wrote:
Lastly, why do developers prefer UNIX over NT environment?
I certainly do not! But I'm sure there are many who do.
Jon Sagara
What about ?
|
|
|
|
|
Emacs is programmable and extensible, there are macro packages for doing just about anything you can imagine.
kuphryn wrote:
Lastly, why do developers prefer UNIX over NT environment? I find the UNIX environment (non-XWindows), primitive
Developers normally use X.
|
|
|
|
|
You should look at SetEdit, a very good editor for DOS and Linux.
It looks like the BC++ 3.0 IDE.
http://setedit.sourceforge.net/
|
|
|
|
|
Thanks.
Turkey gave an insightful perspective to Vi vs. Emacs.
[URL=http://forums.anandtech.com/messageview.cfm?
catid=33&threadid=701805]http://forums.anandtech.com/messageview.cfm?catid=33&threadid=701805[/URL]
He said Vi is faster. He said Emacs has more features.
Console: I think it is clear that more developers mentioned Vi and/or Vim. I have not used Vim. What is the difference between it and Vi?
X: I saw more developers mentioning NEdit. I have not used any X C++ editor. I have used Vi through X's console terminal, but that was the same as console.
Console? Use Vi (Vim?)
X? Use NEdit
Kuphryn
|
|
|
|
|
use 'pico' It is very friendly. I use it. I just open a few telnet (or ssh windows, preferably) and launch pico in each for each file I'll be working on. You files are then stored on your unix host. Additionally I keep another window just for running commands and the compiler in.
You can also use Ultra-edit, which can save to FTP as if it were local.
Or you can develop the code on your machine entirely via Cygwin (search google) It is a complete unix environment (including compilers) for Win32. Then you can still use your .Net editor, but you'll still need a window to compile in.
Happy coding
|
|
|
|
|
Something useful may be :
Kdevelop from the KDE group www.kde.org
"The KDevelop-Project was raised in 1998 to build up an easy to use C/C++ IDE (Integrated Development Enviroment) for Unix. Since then, the KDevelop IDE is publicly available under the GPL and supports KDE/Qt, GNOME, plain C and C++ projects..."
http://www.kdevelop.org
http://www.kdevelop.org/graphics/pic_corner/kdevelop-2.0.gif
You may need to install some support libraries from the KDE project. Also, recent versions of QT libraries (portable GUI library, v.3) come with something like a QEditor...
From the web page:
Before you start compiling your freshly downloaded KDevelop version, make sure that you have installed the following programs. Mind that you can get strange errors, if you use older versions. Program/Library Source
for KDevelop 1.3 an installed KDE 1.x http://www.kde.org
for KDevelop 2.0.2 an installed KDE 2.2.x http://www.kde.org
g++2.8/egcs 1.0.3 (or compatible) www.gnu.org
GNU make www.gnu.org
perl 5.004 www.perl.com
autoconf 2.13/automake 1.4
flex 2.5.4
|
|
|
|