132 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
84
views
issues with "atof" function in MPLAB X IDE v6.25 with XC8 v03.00
I'm working on some code for a PIC microcontroller PIC18F47J53. I'm using MPLAB X IDE v6.25 and the package PIC18F-J_DFP 1.9.170. Both are latest versions.
A year ago, I used exactly the same code, ...
0
votes
2
answers
1k
views
C ASCII to Hex (atoh) Function
I am looking to develop a function that converts a series of ASCII characters (in their respective hex representation) to a single hex value. For example, an input string to this function may be {0x46 ...
0
votes
1
answer
251
views
atof() returns inaccurate value [duplicate]
I am trying to convert a string with max.10 characters into a float-value, using the atof-function. Unfortunately it is not working as the function returns an inaccurate value.
Here is my code:
#...
0
votes
0
answers
56
views
Variable changes unintentionally after character Lcd is moved to display other variables
There is a project of mine which utilizes coordinates to be entered by the user and then processing them for sunrise and sunset time calculations. Although everything seems to work fine but there is ...
-1
votes
2
answers
96
views
Can I place the result into an int variable using either atof or atoi?
In c: Given the following code
int a;
char word[]=<some string>
Is there a difference between?
a = atoi(word)
a = atof(word)
0
votes
2
answers
2k
views
What does atof stand for?
In C atof=a-to-f(loat) converts a string into a double precision float. I am wondering what the a part of atof stand for.
0
votes
0
answers
113
views
How to convert text into a float number in C
I am writing a code that would parse incoming UART messages and extract the information that I want. I will be sending a command and then a floating number for example:
"SET_VOLTAGE:2.4"
I ...
0
votes
1
answer
104
views
how to convert a numeric into a char number?
The problem is the next, generate a new string,
1. In the firt place : the firts letter of the name
2. In the second place : the third letter of the name
3. In the thitd place : The last letter of the ...
3
votes
1
answer
5k
views
Is there any difference in the way atof and strtod work?
I know that strtod() and atof() functions are used for conversion from string to double.
But I can't figure out the difference between these two functions.
Is there any difference between these two ...
1
vote
1
answer
860
views
Is there an alternative to atof in C++
I am finding that atof is limited in the size of a string that it will parse.
Example:
float num = atof("49966.73");
cout << num;
shows 49966.7
num = atof("499966.73");
cout ...
-3
votes
3
answers
181
views
convert string to double , the answer is correct ,but not very accurate [closed]
I want to use atof to convert my string to a double,the answer is correct ,but not very accurate
ATTENTION: because of some other reasons, fscanf is not permitted
my code is :
#include <stdio.h>
...
2
votes
1
answer
108
views
Is `std::atof` guaranteed to produce identical output when given identical string input?
I'm reading double values from file as strings and parsing them with std::atof. Afterwards, I'm using the values as keys in a unordered map. It's seems to be working correctly, but is it guaranteed to ...
0
votes
1
answer
215
views
How to use substr with atof?
Reading from a .txt file, I would like to convert some values from a file, converting a string into doubles. Normally, I can print the desired values:
string line;
ifstream f;
f.open("set11.txt&...
1
vote
2
answers
732
views
C++: strod() and atof() are not returning double as expected
I am trying to make strings into doubles using the values that I obtained from a .txt file.
The doubles I am obtaining have no decimals. I believe that this is because, in the .txt, the decimals of ...
0
votes
0
answers
144
views
C error using the function atof, changing a string to a double
I ́m learning to use these functions that change a string to an int or double, but atof doesn ́t work for me.
char cadena[20]="3.1416";
double x=atof(cadena);
printf("%g",x);
I have this simple code, ...