Results 1 to 3 of 3

Thread: C to VB - Float array to string

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2002
    Location
    NW England
    Posts
    110

    C to VB - Float array to string

    I need to convert my array of 8 floating point numbers into a string in my C program so i can sent it over the network so my VB program can read it.

    How can i do this???

    Thanks
    Matt

  2. #2
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    you might get more response if you post this in the C/C++ forum.

    http://www.vbforums.com/forumdisplay...une=&forumid=9

  3. #3
    Addicted Member HairyDave's Avatar
    Join Date
    Aug 2002
    Location
    Er...I can't remember.
    Posts
    196
    What sort of format do you want? Use function:

    /* FCVT.C: This program converts the constant
    * 3.1415926535 to a string and sets the pointer
    * *buffer to point to that string.
    */

    #include <stdlib.h>
    #include <stdio.h>

    void main( void )
    {
    int decimal, sign;
    char *buffer;
    double source = 3.1415926535;

    buffer = _fcvt( source, 7, &decimal, &sign );
    printf( "source: %2.10f buffer: '%s' decimal: %d sign: %d\n",
    source, buffer, decimal, sign );
    }

    This is the docs given in MSDN. If you want to convert an array, just loop through it.

    Hope it helps - give us a shout if you need a hand.

    HD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width