Just hopefully a simple question about the gcvt() function. Printing out buffer as a result of gcvt(32.000,10,buffer), results in "32." Any way I can get rid of that annoying dot after the 32?
CodePudding user response:
I don't think you can get gcvt to not do that - you can remove it afterward with
if ((p=strchr(buffer,'.'))
*p='\0';
CodePudding user response:
As usual after posting took me 10 mins to figure out a solution.... gcvt is depreciated and I was set on using that because after hours of something not working this helped it work. Anyway, the best way to do this is to use sprintf(buffer, "%f", float_value); Literally does the same thing and no dot at the end!