Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralInteger Input Problem Pin
BRIMID26-Nov-04 2:29
BRIMID26-Nov-04 2:29 
QuestionHow to Resize Web Browser Control when the parent dialog is maximized Pin
sharthee26-Nov-04 1:41
sharthee26-Nov-04 1:41 
AnswerRe: How to Resize Web Browser Control when the parent dialog is maximized Pin
Maximilien26-Nov-04 2:27
Maximilien26-Nov-04 2:27 
GeneralRe: How to Resize Web Browser Control when the parent dialog is maximized Pin
sharthee28-Nov-04 20:22
sharthee28-Nov-04 20:22 
GeneralGaussian Noise generation Pin
goliath0126-Nov-04 1:09
goliath0126-Nov-04 1:09 
GeneralTAB not working properly in WebBrowser control embeded in modeless dialog box encapsulated within an ATL DLL Pin
sashishk26-Nov-04 1:05
sashishk26-Nov-04 1:05 
Generalfail to envoke shutdown socket function. Pin
amitranjanmishra26-Nov-04 1:01
amitranjanmishra26-Nov-04 1:01 
GeneralRe: fail to envoke shutdown socket function. Pin
John R. Shaw26-Nov-04 8:14
John R. Shaw26-Nov-04 8:14 
I do not know about your actual problem, but you have other problems.

char *buff;
buff=(char *)malloc(1);

recv(server,buff,sizeof(buff),0);
recv(client,buff,sizeof(char),0);

buff[n]=0;

1) Allocating a 1 character buffer makes no since and you never free the memory allocated. Just declare a single character variable or a small buffer: char buff; or char buff[1];

2) These two statements are not the same thing:
recv(server,buff,sizeof(buff),0);
recv(client,buff,sizeof(char),0);

sizeof(buff) == sizeof(char*) NOT sizeof(char);

If you had declared the buff variable as buff[1] or buff then
sizeof(buff) would equal sizeof(char).

3) buff[n]=0;
if n is anything other than 0, then your thread may (should) crash.
buff[1] = 0; // ERROR

4) Unless you have a good reason, constantly opening and closing the file in the outer loop is probably a bad idea too!



INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
GeneralRe: fail to envoke shutdown socket function. Pin
amitranjanmishra26-Nov-04 19:39
amitranjanmishra26-Nov-04 19:39 
GeneralRe: fail to envoke shutdown socket function. Pin
John R. Shaw27-Nov-04 5:26
John R. Shaw27-Nov-04 5:26 
GeneralMFC App for Threads & Virtual Memory Pin
skysurf26-Nov-04 0:51
skysurf26-Nov-04 0:51 
GeneralRe: MFC App for Threads & Virtual Memory Pin
suiram4026-Nov-04 7:14
suiram4026-Nov-04 7:14 
GeneralI need a Win32 based Source code Pin
ThatsAlok26-Nov-04 0:27
ThatsAlok26-Nov-04 0:27 
GeneralRe: I need a Win32 based Source code Pin
PJ Arends26-Nov-04 8:10
professionalPJ Arends26-Nov-04 8:10 
GeneralRe: I need a Win32 based Source code Pin
ThatsAlok26-Nov-04 17:13
ThatsAlok26-Nov-04 17:13 
Generalupdate resource Pin
vrajarathnam26-Nov-04 0:22
vrajarathnam26-Nov-04 0:22 
GeneralC++ Excel file writer Pin
magicbassfr26-Nov-04 0:09
magicbassfr26-Nov-04 0:09 
GeneralRe: C++ Excel file writer Pin
BadJerry13-Apr-06 22:24
BadJerry13-Apr-06 22:24 
Generali need Imgocxd.hlp Pin
25-Nov-04 22:56
suss25-Nov-04 22:56 
GeneralGlobal mesage hook issues Pin
vishalmore25-Nov-04 22:01
vishalmore25-Nov-04 22:01 
GeneralRe: Global mesage hook issues Pin
vishalmore26-Nov-04 20:22
vishalmore26-Nov-04 20:22 
Generalload multiple image (both photo1 and photo2) Pin
vc-programmer-25-Nov-04 19:59
vc-programmer-25-Nov-04 19:59 
GeneralRe: load multiple image (both photo1 and photo2) Pin
Anonymous25-Nov-04 21:49
Anonymous25-Nov-04 21:49 
GeneralRe: load multiple image (both photo1 and photo2) Pin
namaskaaram25-Nov-04 22:04
namaskaaram25-Nov-04 22:04 
GeneralRe:Thank You Pin
vc-programmer-25-Nov-04 22:32
vc-programmer-25-Nov-04 22:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.