How I can Give a float Variable (number from text file)

How I can Give a float Variable (number from text file)
Hello
i have a text at this path C:\wamp\www\usd_ask.txt
and this file is Just have a number like 3.4087
i wana give this value to a variable
Can you help me?:)
I believe you would use a stringstream:

http://www.cplusplus.com/reference/iostream/stringstream/
sorry i cant find what im need
fscanf will work, but that's C not C++. It'll work, but you might want to find the C++ version if you're using C++

http://www.cplusplus.com/reference/clibrary/cstdio/fscanf.html
btw, what firedraco was saying was that you make a stringstream, then use the functions of stringstream to pull in the variable. It's worth doing if you're learning C++ and not just straight C
Hello, really i cant understand the good way to make it....
But look!!
let the float variable is "usdask"
so its
float usdask;
and i wanna give it this number which putted at the text file "3.415";
this is the file link "C:\wamp\www\usd_ask.txt"
How is the code which i can use????
Stringstreams :D
its un work
sorry
Topic archived. No new replies allowed.