Click here to Skip to main content
15,895,084 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Finding files older than a week Pin
m.dietz21-Nov-06 20:31
m.dietz21-Nov-06 20:31 
GeneralRe: Finding files older than a week Pin
CPallini21-Nov-06 21:51
mveCPallini21-Nov-06 21:51 
QuestionATL::CSimpleStringT ?? [modified] Pin
dharani20-Nov-06 23:25
dharani20-Nov-06 23:25 
AnswerRe: ATL::CSimpleStringT ?? Pin
Viorel.20-Nov-06 23:34
Viorel.20-Nov-06 23:34 
GeneralRe: ATL::CSimpleStringT ?? Pin
dharani20-Nov-06 23:37
dharani20-Nov-06 23:37 
GeneralRe: ATL::CSimpleStringT ?? Pin
Rajesh R Subramanian20-Nov-06 23:57
professionalRajesh R Subramanian20-Nov-06 23:57 
AnswerRe: ATL::CSimpleStringT ?? Pin
James R. Twine21-Nov-06 0:36
James R. Twine21-Nov-06 0:36 
QuestionArray Question Pin
Programm3r20-Nov-06 22:53
Programm3r20-Nov-06 22:53 
Hi all,

First of all, I would like apologize for creating a new thread, but I'm getting desperate.

This is the scenario:

I have this structure:
<br />
static struct<br />
{<br />
	 int ConnectSock;		// (virtual) socket for connection<br />
	 int ConnectState;		// next state<br />
	 ULONG BytesTrans;		// # bytes transmitted in this upload<br />
	 ULONG FileLength;		// length of file being transmitted<br />
	 ULONG TimeMark;		// time to wait until next state<br />
	 char Request[STRING_SIZE];	// command request<br />
	 char FileName[STRING_SIZE];	// filename<br />
	 char PathName[STRING_SIZE];	// pathname<br />
	 char PCName[STRING_SIZE];	// Remote Controller Name<br />
	 ULONG BytesRec;		// Bytes Received<br />
} gConnectData[MAX_CONNECT];<br />


Before I populate the PCName variale, I do the following, get an open slot for the next connection:
<br />
int FindFreeSlot(void)<br />
{<br />
 int i, s;<br />
 for(i=0;i<MAX_CONNECT;i++)<br />
 {<br />
     s = gConnectData[i].ConnectSock;<br />
     if(s==-1)<br />
      return i;<br />
 }<br />
 return -1;<br />
}<br />
main()<br />
{<br />
...<br />
 while(1)<br />
 {<br />
  i = FindFreeSlot();<br />
  ...<br />
 }<br />
}<br />


I when populate the PCName variable of the structure with data:
Please note that the for loop is part of the while loop.
<br />
for(i=0;i<MAX_CONNECT;i++)<br />
{<br />
 ...<br />
 strcpy((char*)gConnectData[i].PCName,(char*)strDest);<br />
 ...<br />
}<br />


Ok, I'll try an explain this the best I can:
The thing is that the variable i does not move in a sequence (because of the server having to know which connection it's communicating with), for instance if I print the following the output would be:
<br />
// please not that the code is also part of the while & for loop<br />
// strDest would be the computer name passed by the client(s).<br />
strcpy((char*)gConnectData[i].PCName,(char*)strDest);<br />
// i can be 1 and the next cycle it could 0 ....<br />
// so the previous element gets the next elements name and so on.<br />
printf("\n### Connection Sock -> %d Int Value -> %2d PC NAME VALUE -> %s\n",Sock,i,(char*)gConnectData[i].PCName);<br />

Connection Sock -> 0 Int Value -> 0 PC NAME VALUE -> PCOne
next cycle
Connection Sock -> 1 Int Value -> 1 PC NAME VALUE -> PCTwo
next cycle
Connection Sock -> 1 Int Value -> 1 PC NAME VALUE -> PCOne

Does it make sense Confused | :confused:
Can anyone help??
Many thanx in advance


The only programmers that are better than C programmers are those who code in 1's and 0's..... Smile | :)

Smile | :) Programm3r

AnswerRe: Array Question Pin
Programm3r20-Nov-06 23:47
Programm3r20-Nov-06 23:47 
GeneralRe: Array Question Pin
toxcct21-Nov-06 0:29
toxcct21-Nov-06 0:29 
QuestionVS 2005 Express C++ code in header files!? Pin
floenk20-Nov-06 22:46
floenk20-Nov-06 22:46 
AnswerRe: VS 2005 Express C++ code in header files!? Pin
Christian Graus20-Nov-06 23:03
protectorChristian Graus20-Nov-06 23:03 
QuestionCtreeCtrl Popupmenu Pin
harsha_123420-Nov-06 22:45
harsha_123420-Nov-06 22:45 
AnswerRe: CtreeCtrl Popupmenu Pin
Mila02520-Nov-06 22:57
Mila02520-Nov-06 22:57 
GeneralRe: CtreeCtrl Popupmenu Pin
harsha_123420-Nov-06 23:09
harsha_123420-Nov-06 23:09 
GeneralRe: CtreeCtrl Popupmenu Pin
Mila02520-Nov-06 23:31
Mila02520-Nov-06 23:31 
GeneralRe: CtreeCtrl Popupmenu Pin
harsha_123421-Nov-06 1:03
harsha_123421-Nov-06 1:03 
AnswerRe: CtreeCtrl Popupmenu Pin
Viorel.20-Nov-06 23:13
Viorel.20-Nov-06 23:13 
QuestionOpen file and recent files in MFC Pin
includeh1020-Nov-06 22:40
includeh1020-Nov-06 22:40 
AnswerRe: Open file and recent files in MFC Pin
XtremDev20-Nov-06 22:51
XtremDev20-Nov-06 22:51 
QuestionApplication hibernation [modified] Pin
SelvaKr20-Nov-06 21:47
SelvaKr20-Nov-06 21:47 
AnswerRe: Application hibernation Pin
Ștefan-Mihai MOGA20-Nov-06 21:52
professionalȘtefan-Mihai MOGA20-Nov-06 21:52 
GeneralRe: Application hibernation Pin
SelvaKr20-Nov-06 21:56
SelvaKr20-Nov-06 21:56 
AnswerRe: Application hibernation Pin
Christian Graus20-Nov-06 21:59
protectorChristian Graus20-Nov-06 21:59 
GeneralRe: Application hibernation Pin
SelvaKr20-Nov-06 22:07
SelvaKr20-Nov-06 22:07 

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.