How do I convert a double variable to a string so that I can determine the length of the string using strlen()?
Yes. I need to know the number of characters in the variable.Are you just trying to find the amount of characters in the var?
That isn't what I'm after.someonesdad said:There's no unique string representation of a given double, as there are lots of approximate choices. Examples: printf("%.3f", v), printf("%.8f, v), printf("%.4e", v).
If this isn't what you're after, then you'll have to give us a bit more of what you're after.
while (Rs != l + 1)
{
current = v/(Rs + l);
p1 = (pow(current, 2)) * Rs;
p2 = (pow(current, 2)) * l;
p_resist = p1 * pow(10, 3);
p_load = p2 * pow(10, 3);
// int pr;
// char buffer[10];
// char len;
// pr = sprintf(buffer, "%lf", p_resist);
// printf("\n>>>%d\n", pr);
// if (strlen(pr) < 5)
// strcat(pr, " ");
// strcat(linetoprint, pr);
// printf("%s", linetoprint);
by Aaron Carman
by Duane Benson
by Duane Benson