Results 1 to 6 of 6

Thread: Transferring data using visual C++ 6.0

  1. #1
    Join Date
    Jun 2011
    Posts
    84

    Transferring data using visual C++ 6.0

    Can anyone help me to solve this problem? I am making a program from which I can transfer and receive data from server computer. My problem arises when I receive data from server it showed on editbox like this: "|?|". Data from server such as the below hexa code:
    Code:
    11
    03
    00
    6B
    00
    03
    84
    48
    I am using visual C++ 6.0 and I am new to it.

  2. #2
    Join Date
    May 2009
    Posts
    511

    Re: Transferring data using visual C++ 6.0

    I think you have to make some changes in your coding part. Copy paste the below mentioned code. After copy pasting check it by sending and receiving data from server.
    Code:
    int sprintf(
       char *buffer,
       const char *format [,
       argument] ... 
    );
    int _sprintf_l(
       char *buffer,
       const char *format,
       locale_t locale [,
       argument] ... 
    );
    int swprintf(
       wchar_t *buffer,
       size_t count,
       const wchar_t *format [,
       argument]...
    );
    int _swprintf_l(
       wchar_t *buffer,
       size_t count,
       const wchar_t *format,
       locale_t locale [,
       argument] ... );

  3. #3
    Join Date
    May 2009
    Posts
    543

    Re: Transferring data using visual C++ 6.0

    If you still did not found any help then you can take reference from the below code. Just go through the code and make some changes as per your requirement and paste it in your actual source.

    Code:
    int __swprintf_l(
       wchar_t *buffer,
       const wchar_t *format,
       locale_t locale [,
       argument] ... 
    );
    template <size_t size>
    int sprintf(
       char (&buffer)[size],
       const char *format [,
       argument] ... 
    ); 
    template <size_t size>
    int _sprintf_l(
       char (&buffer)[size],
       const char *format,
       locale_t locale [,
       argument] ... 
    ); 
    template <size_t size>
    int swprintf(
       wchar_t (&buffer)[size],
       size_t count,
       const wchar_t *format [,
       argument]...
    );

  4. #4
    Join Date
    May 2009
    Posts
    529

    Re: Transferring data using visual C++ 6.0

    If you had mentioned your code that you are using in the question then it would have been easier for me to rectify the error. So by the time let’s assume. See the below code, I hope it’s enough for you to take necessary reference from it.
    Code:
    // crt_sprintf.c
    // compile with: /W3
    // This program uses sprintf to format various
    // data and place them in the string named buffer.
    #include <stdio.h>
    int main( void )
    {
       char  buffer[200], s[] = "computer", c = 'l';
       int   i = 35, j;
       float fp = 1.7320534f;
    
       // Format and print various data: 
       j  = sprintf( buffer,     "   String:    %s\n", s ); // C4996
       j += sprintf( buffer + j, "   Character: %c\n", c ); // C4996
       j += sprintf( buffer + j, "   Integer:   %d\n", i ); // C4996
       j += sprintf( buffer + j, "   Real:      %f\n", fp );// C4996
       // Note: sprintf is deprecated; consider using sprintf_s instead
       printf( "Output:\n%s\ncharacter count = %d\n", buffer, j );

  5. #5
    Join Date
    May 2009
    Posts
    539

    Re: Transferring data using visual C++ 6.0

    The below code is for transferring data. After writing this code you can transfer data from server computer easily.
    Code:
    CString dulieu = data.bstrVal;
    for(int i = 0; i < dulieu.GetLength(); ++i)
    {
       s.Format(_T("%02X"), dulieu[i]);
       m_strReceive += s;
    }

  6. #6
    Join Date
    Apr 2009
    Posts
    488

    Re: Transferring data using visual C++ 6.0

    See the code below. With the help of this code you can create unreal COM port. You can create it by Configure Virtual Serial Port Driver. After creating this you can send data like 10 or 5B and it will show "42231C".

    Code:
    CString dulieu,s;
    VARIANT data=m_mscomm1.GetInput();
    dulieu+=data.bstrVal;
    s.Format(_T("%02X"),dulieu);
    m_strReceive+=s;
    but when i create unreal COM port by Configure Virtual Serial Port Driver 
    and send data like 10 or 5B it show "42231C".

Similar Threads

  1. Transferring xbox data complication
    By meowboomfist in forum Video Games
    Replies: 1
    Last Post: 04-01-2012, 06:29 PM
  2. Transferring data from HTC Desire to HTC Sensation XE?
    By $o$^ in forum Portable Devices
    Replies: 4
    Last Post: 27-11-2011, 03:18 PM
  3. Transferring binary data through PHP
    By Welsh in forum Software Development
    Replies: 5
    Last Post: 29-01-2010, 05:21 PM
  4. Different ways for transferring data from one PC to another
    By Ernesto4 in forum Technology & Internet
    Replies: 5
    Last Post: 06-01-2010, 02:53 PM
  5. Transferring data from failing hard drive
    By DJ SAN in forum Hardware Peripherals
    Replies: 3
    Last Post: 25-08-2009, 10:11 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,452,488.90855 seconds with 16 queries