//======================================================================
sprintf(msg, "~file~%s~%lu", szFileTitle, dwFileSize);//my command
MessageBox(hMainWnd, msg, "send test", MB_OK);
nRet = send(mainsock, msg, strlen(msg), 0);
//======================================================================
/*
later i revc() it
*/
//======================================================================
if(!strcmp(kom, "file")) //file comming
{
//show string!!!
MessageBox(hMainWnd, msg, "recieved", MB_OK);
//extract name and length
i+=1;//skip tilde after the kommand
int p=0;
while(msg!='~')
{
fName = msg;
++p;
++i;
}
fName = '\0';
char strDW[100]= " +";//MSDN says atol() need it
p=2;
while(msg!='\0')
{
strDW = msg;
++p;
++i;
}
strDW = '\0';
dwFileSz = atol(strDW);
//sscanf(strDW, "%lu", &dwFileSz);
//dwFileSz = ntohl(dwFileSz);
//accept file prompt
sprintf(strDW, "%s is sending you file: %s %luB big.\r\n \ Do you accept?", remote_name, fName, dwFileSz);
ret = MessageBox(hMainWnd, strDW,
"File comming", MB_YESNO | MB_ICONQUESTION);
//==========================================================================
how do you recv() numbers?
i thought it would be easy but the following does not work:
the first MB shows exactly what i send but later but the last one does not!
it says the file is "0B" /zero/ big.
what is wrong with my conversions???
[Edited by - alexscorpion on February 28, 2006 10:26:40 AM]
Why don't you step through the code and see where the information is getting lost? Personally I have trouble following your low-level string handling functions and I expect the problem is in there.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement