well, maybe it's "m_sendmsg" instead... ?
regards
Main Topics
Browse All TopicsInfinity08
Here is my qns which is I am not able to send the table ,special order and quantity to server...is there any help??
//send btn handler...
UpdateData();
char buffer[101];
int len = wcstombs(buffer, m_sendmsg,100);//causing error
m_psock->Send(buffer, len);
error msg:'wcstombs' : function does t take 4 parameters
Is there any way to send the above..i could only send the food item...
Also, i would like to do the coding
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
For the other experts : this is a question regarding http://www.experts-exchang
For int_acct :
check the function documentation :
http://msdn.microsoft.com/
It will explain you how to use it, even with an example.
m_sendmsg should be defined as a wchar_t*
Infinity08
Actually, my error code is ..
UpdateData();
char buffer[101];
int len = wcstombs(buffer, m_sendmsg,m_table ,m_qty,m_sp,100);//causing
m_psock->Send(buffer, len);
'wcstombs' : function does not take 6 parameters
I can't send send the above to server...is there any method in which can send the above...
the m_sendmsg..is the item which i can send to server.. t the table ,qty and special order...pls help me with this..very urgent
The error plainly states, in the first instance, that wcstombs does not take 4 parameters. That is correct; wcstombs expects ONLY 3 parameters. I'm wondering why it thinks there are 4 parameters specified when I only see 3 in the code. In the latter example where 6 parameters are specified the error is, at least, more obvious. Seems to me, just guessing, with regard to the first example provided that the problem is either syntax or an error with regard to expected argument 'type'.
as i said, int_acct, please check this link :
http://msdn.microsoft.com/
It explains what the function does, and how you should use it.
Either this is not the function you want, or you're using it incorrectly.
Either treat them seperately, or put all data in the same array, and then convert that array with that function (at the receiving end, you'll have to convert it back to the original array then, and split the array to its original parts).
Afaik, there's no function that takes multiple parameters of that type.
The call
>> m_psock->Send(buffer, len);
expects buffer to be a character array. So, you'll have to convert your data to a character array in order to send it. How you do that is totally up to you. A character array is the most general format you can have to send data over a network. You can put anything you want in it. It all depends in what format you have it before sending, and in what format you want it after receiving.
Infinity08
i am sending the table No, and the quantity which is in the integer format while the item and special orders are in CString format, my objective is to send this 2 different formats to the server, what are the simpler ways of sending these orders to the server..becos we really dun understand how to do it...urgent
It will have to be converted to a byte array, no matter how you turn it :)
To pack your data in 1 byte array, you'll have to devise a simple encoding/decoding protocol to encode the data into a byte array, and decode the byte array to the data. This doesn't have to be difficult.
For example, you can take 4 bytes for each integer, and a null terminated character array for the CString's.
---- example of the last ----
if you want to send this :
Table No. : 35
Items : spaghetti
qty : 2
Special orders : none
then your general encoded byte array would look like :
|<-- 4-bytes(tableno) -->|<-- null-terminated(items) -->|<-- 4-bytes(qty) -->|<-- null-terminated(special) -->|
or with the data in it (conceptual) :
|<-- 35 -->|<-- "spaghetti" -->|<-- 2 -->|<-- "none" -->|
now :
35 encoded in 4 bytes : 0x00000023
"spaghetti" (using ASCII values and terminated by a null) : 0x73706167686574746900
2 encoded in 4 bytes : 0x00000002
"none" (using ASCII values and terminated by a null) : 0x6e6f6e6500
and finally the actual byte string (concatenation of the previous 4) :
0x000000237370616768657474
which is 23 bytes long.
When you receive that byte string on the server, you can easily decode it by :
1) taking the first 4 bytes (0x00000023) and converting it back to 35
2) taking the next series of bytes untill you get a null (0x73706167686574746900) and get "spaghetti"
3) taking the first 4 bytes (0x00000002) and converting it back to 2
4) taking the next series of bytes untill you get a null (0x6e6f6e6500) and get "none"
Voila :)
---- end example ----
Of course this is just an example, and you might want to do it a bit differently :)
i have a problem understanding this set of codes, can anybody explain to me?
void CBasicSocketServerDlg::OnR
{
char buffer[101];
// len is the number of bytes already added
// fill up with spaces
int num = m_pConnSock->Receive(buffe
buffer[num] = '\0';
if ( num < 100)
{
m_msgs += CString(' ', 59-num);
num = 59;
}// you may be overwritting the last character with this.
m_msgs += CString(buffer); // Accumlate the entire message.
UpdateData(FALSE);
I have another problem here which is my server cannot send data to the Pocket PC using ad-hoc connection, i am using the lap-top's internal adpater to connect wirelessly to the server, the lap top can send data to the server and the data can also be displayed on the server's UI whereas the server cannot send any data to the Pocket PC. I hardcode my port number in my server and my question is how to locate the Pocket PC's port number so that i can hardcode the same port number as the Pocket PC? can u pls help, its really extremely urgent!!
To be more specific with the question above is that the laptop(Server) is unable to send any data to the Pocket PC(client) uisng ad-hoc connection, i hardcode the Lap-top's port number but i am not sure it is the right way to do it, can anyone tell me how to check for Pocket PC's port number? However the Pocket PC is able to send data wirelessly to the lap-top(Server). Pls help me..cos it is very urgent..i ahve to resolve this issue as soon as possible
Business Accounts
Answer for Membership
by: sverxPosted on 2005-08-23 at 02:56:17ID: 14731698
try
char *buffer =(char *)malloc( 102 );
instead of
char buffer[101];
regards