|
Anders Molin wrote:
And when du you send the data, are you in the right state, and have the server accepted that state?
I don't knwo what do you mean by this,If I send some .txt data there is no problem,and there is no problem with how much of it,so I don't think there is problem with state.
Anders Molin wrote:
Whan does the server tell you just before it hangs up....
it gives you an errorcode lige 505 or something...
No,Before this error theere is no other error.
Mazy
No sig. available now.
|
|
|
|
|
Is ++i statement in the for loop better than i++?
I have heard so many people said that. They said
it is good for memory management. Could someone
gives me a better explanation?
|
|
|
|
|
The theory is that with a post increment you have to make a copy of the object, increment the original, and then return the copy of the object. With a pre increment, you increment the object and then return it. Thus pre increment saves the need to make a copy of the object.
The good news is that 99.9% of the time, it makes no difference at all. However, the more complicated the objects are (i.e. real objects and not just simple data types), then you can see a performance increase by using pre increment.
It all boils down to this: Unless you have a specific need to use post increment, you should use pre increment. It won't buy you anything most of the time, but once you get in the habit of using it, you don't have to worry about the cases where it does buy you something.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
[quote]It all boils down to this: Unless you have a specific need to use post increment, you should use pre increment. It won't buy you anything most of the time, but once you get in the habit of using it, you don't have to worry about the cases where it does buy you something.[/quote]
Does the above statement applies to all application? or just
when you are using for loop? How about in while loop and all
other situation?
In what situation do we have to use post increment(i++)?
Thanks.
|
|
|
|
|
VW_Red_Jetta wrote:
In what situation do we have to use post increment(i++)?
None. You don't have to use a post (or pre) increment anywhere, but for convenience a common place is when indexing arrays:
char ch = pStr[offset++];
This is functionally the same as:
char ch = pStr[offset];<br />
++offset;
And results in exactly the same code for simple objects.
|
|
|
|
|
I highly recommend ++i over i++.
Kuphryn
|
|
|
|
|
To answer your original question, there is no difference at all. The compiler will optimize away the copy of i that normally gets made in the expression i++ , because it sees that the copy isn't being used.
--Mike--
Eh! Steve!
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
OK, but if you don't use optimization (it can be useful for something), it does matter
LPCTSTR Dutch = TEXT("Double Dutch ");
|
|
|
|
|
Not for a simple loop and/or case such as this.
|
|
|
|
|
Hello,
I have a problem with using DLLs...
My main project is written in MSVC++, the DLLs are written in Dev-C++/GCC. Loading the DLLs works fine, as well as calling void functions of the DLLs. Now my problem is that when I try to call a function which doesn't return void (so, for example, an unsigned long), the main program crashes after the call to the DLL...
I tried to make the functions in the DLL and the function prototypes in the main app __stdcall but it doesn't change anything.
The functions are exported in C format (the DLL gets loaded correctly...).
Do you have any idea why a non-void function of a DLL crashes my app? I never hat this problem when making DLLs with MSVC++, only now when compiling them with Dev-C++/GNU-GCC...
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
Okay, WHY do you have to make your DLL in Dev-C++? You have VC++ so why don't you make it in VC++?
If you post your code that calls the DLL function it would be easier to help you!
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
well my question really divides into two:
i wanted to save new pictures from old pictures, and add the time to them.
that's when i got to my first question:
[1] i could only save the new pics as gif and bmp, other formats gave me
invalid parameter. why? and how do i fix it?
then i thought to myself "ok, nevermind, i'll just save it as bmp, and then
open it from a new Bitmap object and save it as another format". - wow, it
actually worked, but then i got to my second question:
[2] i can't delete the temporary bmp file, since it's being used, even when
i used pointer to a bitmap and deleted it, it still couldn't delete the
file. why? and how do i fix it? (i used the DeleteFile function)
can anyone help me about these two questions, or one of them, please!
thanks
|
|
|
|
|
i create an application who should draw five(or another number) of cube with sphere ,but i have a problem with it,it just draw one sphere and one cube and i don't know what.
i has used a vector to store the sphere and the cube that i create.
<br />
<br />
#include "stdafx.h"<br />
#include "OpenGl.h"<br />
#include "creatfoufou.h"<br />
#include "foufou.h"<br />
#include <vector><br />
<br />
#include <math.h><br />
<br />
#ifdef _DEBUG<br />
#undef THIS_FILE<br />
static char THIS_FILE[]=__FILE__;<br />
#define new DEBUG_NEW<br />
#endif<br />
<br />
<br />
using namespace std;<br />
vector< foufou * > fou_caracter;<br />
<br />
<br />
creatfoufou::creatfoufou()<br />
{<br />
ptrfoufou = new foufou;<br />
<br />
<br />
}<br />
<br />
creatfoufou::~creatfoufou()<br />
{<br />
<br />
}<br />
<br />
void creatfoufou::creatfou(int amount)<br />
{<br />
foufou *newfoufouPtr;<br />
int randomX,randomY,randomZ;<br />
int speed,steer;<br />
<br />
for(int index=0;index<amount;index++)<br />
{<br />
newfoufouPtr = new foufou();<br />
fou_caracter.push_back( newfoufouPtr );<br />
randomX = ( ( 1 + rand( ) % 100 ) - 50 );<br />
randomY =( ( 1 + rand( ) % 100 ) - 50 );<br />
randomZ =( ( 1 + rand( ) % 100) - 50);<br />
<br />
setposition(randomX,randomY,randomZ);<br />
<br />
<br />
<br />
}<br />
}<br />
<br />
void creatfoufou::setposition(int newX, int newY, int newZ)<br />
{<br />
<br />
ptrfoufou->RePaint(newX,newY,newZ);<br />
}<br />
|
|
|
|
|
Do these vectors differ from each other? Check out srand /rand functions.
Regards,
BB
|
|
|
|
|
witch vector?
i will send you the project in your mail
|
|
|
|
|
|
Hello *.*!
I'm just programming a little app with MFC. I wonder if there is a simple control that took my output data but there was only the listbox. It is very sinewy to collect all chars to a single line, delete the \n \l 's an then use the AddString function to put it out.
I need to output to a control in a dialog like with printf:
printf("bla bla");
printf("blubb blah \n"); <- NOW the new line!!
and so on...
Did anyone of you have an idea to solve my problem? But I can't use the win32-console-application since I have to use MFC and dialogs!
Thanks in advance, Jan
|
|
|
|
|
A textbox could do the trick, by doing something like
txtBox->SetWindowText(txtBox->GetWindowText() + CString(_T("Some text")))
LPCTSTR Dutch = TEXT("Double Dutch ");
|
|
|
|
|
The socket on the side of server maintain a queue to save the requirements of
connection.When the socket on the side of server agreed with a requirement of connection,it formed a new socket to connect to the client.My question is that how to get the information of a client from the queue,for I want to identify each of the clients.I want to send different messages to different clients,how can I get the socket of a client from the queue?
|
|
|
|
|
You can call getpeername to get information about the client (LPSOCKADDR).
ÿFor the bread of God is he who comes down from heaven and gives life to the world. - John 6:33
|
|
|
|
|
Can you explain it in detail?thanks!
|
|
|
|
|
Another solution is getnameinfo() and save either the IP or domain name in a database.
Kuphryn
|
|
|
|
|
Please teach me in detail,thank you very much!
|
|
|
|
|
Hi all
I have an application which calls another thread with own window procedure.
Inside that another window I put edit control.
My problem is that I can not type anything inside that Edit Control.
It looks, that it does not have keyboard focus.So, I tryed to work with SetFocus(), but it did not help.
Please answer my question.
Tahnks.
Nena
|
|
|
|
|
What kind of thread does the main thread spawn? In other words, the child thread should be a UI thread if you want to update the edit control.
Kuphryn
|
|
|
|