Question

Help in sending the table no, Item, special orders, quantity

Asked by: int_acct

Infinity08

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.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2005-08-23 at 02:33:22ID21536490
Topic

Miscellaneous Programming

Participating Experts
3
Points
500
Comments
26

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

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.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

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.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

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.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Accumulating Quantities
    Ok, my Parent document is a Purchase Order. In this purchase order we have the quantities ordered. In the delivery section we fill out quantities actually received and mark the rest as backordered items. When a few more items are delivered, I click on the button on the parent...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

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.

Join the Community

Answers

 

by: sverxPosted on 2005-08-23 at 02:56:17ID: 14731698

try
char *buffer =(char *)malloc( 102 );

instead of
char buffer[101];


regards

 

by: sverxPosted on 2005-08-23 at 02:57:49ID: 14731710

well, maybe it's "m_sendmsg" instead... ?

regards

 

by: int_acctPosted on 2005-08-23 at 03:00:42ID: 14731722

sverx

thanks for yr help, i will look into it

 

by: Infinity08Posted on 2005-08-23 at 03:01:22ID: 14731725

For the other experts : this is a question regarding http://www.experts-exchange.com/Programming/Q_21520442.html

For int_acct :

check the function documentation :

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_wcstombs.asp

It will explain you how to use it, even with an example.

m_sendmsg should be defined as a wchar_t*

 

by: int_acctPosted on 2005-08-23 at 03:21:01ID: 14731806

Infinity08

thanks so much for yr help again..

 

by: int_acctPosted on 2005-08-23 at 04:08:22ID: 14732000

Infinity08

Actually, my error code is ..

UpdateData();
char buffer[101];
int len = wcstombs(buffer, m_sendmsg,m_table ,m_qty,m_sp,100);//causing error
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

 

by: jrs_50Posted on 2005-08-23 at 05:41:16ID: 14732485

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'.

 

by: Infinity08Posted on 2005-08-23 at 06:10:03ID: 14732905

as i said, int_acct, please check this link :

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_wcstombs.asp

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.

 

by: int_acctPosted on 2005-08-23 at 08:35:10ID: 14734565

Infinity08

th function which i actually wanted is how to send all the items which are selected by the user to send across to the server?  

 

by: int_acctPosted on 2005-08-23 at 08:37:29ID: 14734594

Infinity08

the user will select the items from the combo box and he/she will clicked teh send button and all teh items is send to the server..my objective is to send all the 4 items to the server..pls help, its really urgent now

 

by: int_acctPosted on 2005-08-23 at 22:13:57ID: 14739837

Infinity08

the reason is becos if i use wcstombs, i cannot send 5 parameters to the server and i want to know which function can take in at least  5 parameters...can u pls help me cos time is really critical now....

 

by: Infinity08Posted on 2005-08-24 at 00:06:13ID: 14740203

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.

 

by: int_acctPosted on 2005-08-24 at 00:16:17ID: 14740248

Infinity08

Is there any other simple methods of doing it becos using arrays is really a bit complicated and we r really running out of time?

 

by: int_acctPosted on 2005-08-24 at 00:21:01ID: 14740262

Infinity08
 

becos we have to send the table No, special orders, qty and m_message and buffer to the server so we have been trying very hard to find a solution for this, do u have any suggestions to this problem?

 

by: Infinity08Posted on 2005-08-24 at 00:30:35ID: 14740297

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.

 

by: int_acctPosted on 2005-08-24 at 00:42:40ID: 14740346

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

 

by: int_acctPosted on 2005-08-24 at 01:56:18ID: 14740681

Infinity08

besides array what other methods can u suggest?

 

by: Infinity08Posted on 2005-08-24 at 03:04:22ID: 14740958

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) :

0x0000002373706167686574746900000000026e6f6e6500

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 :)

 

by: int_acctPosted on 2005-08-24 at 03:11:48ID: 14740989

Infinity08

is there anyway to modify the codes becos we really dun have much time left? sry..its really too urgent now

 

by: int_acctPosted on 2005-08-24 at 03:14:38ID: 14740996

Infinity08

what i mean is which part of the codes we have to modify becos we really do not have much time left?

 

by: Infinity08Posted on 2005-08-24 at 06:02:58ID: 14741997

The part you showed in your first message : where you're sending the message. Just put everything you want to send in ONE byte array (char[]) and send it to the server. On the server side, where you receive the message, you simply extract the daat from the received byte array, and there you go ...

 

by: int_acctPosted on 2005-08-30 at 07:23:16ID: 14784730

i have a problem understanding this set of codes, can anybody explain to me?

void CBasicSocketServerDlg::OnReceiveData(void)

{


      char buffer[101];
      // len is the number of bytes already added
              // fill up with spaces

     int num = m_pConnSock->Receive(buffer, 100);
     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);

 

by: Infinity08Posted on 2005-08-30 at 22:12:17ID: 14791026

I've already asked you in the other thread what the 59 is doing there ...

 

by: int_acctPosted on 2005-08-31 at 06:33:55ID: 14793497

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!!

 

by: int_acctPosted on 2005-08-31 at 07:11:00ID: 14793891

i have make a mistake here which is
 >>>> lap top can send data to the server
 
it should be >> Pocket PC is able to send data to the lap top

>>using a lap top to connect to the server--> error

should be >>>  lap top connect to the Pocket PC

the server is the lap top

 

by: int_acctPosted on 2005-08-31 at 08:07:15ID: 14794535

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

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...