Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


donguow

Member Since 10 Jan 2012
Offline Last Active Nov 11 2012 12:21 AM

#4911816 sprintf and sprintf_s

Posted by donguow on 10 February 2012 - 05:39 PM

float bufferData[] = {
5.81414, 5.49492, 3.87633,
6.58321, 4.59523, 4.4363,
6.54791, 4.60198, 4.43473,
5.81414, 5.49492, 3.87633,
//.........
//.........
6.54791, 4.60198, 4.43473,
6.01867, 4.9006, 4.2733,
5.81414, 5.49492, 3.87633,
};

int N = sizeof(bufferData)/sizeof(float);
int offset=0;
char buf[2000];//big enough
for (int i = 0; i < N; i++)
{
sprintf(buf+offset, "%f ", bufferData[i]);//Leave a blank space behind %f, since you want to

decode it later.


offset+=strlen(buf+offset);
//send buf to the client
}

Thanks gdboy, I will try this way and let see how it goes Posted Image


PARTNERS