将文件的字符串转换为float [英] converting the string of a file to a float

查看:77
本文介绍了将文件的字符串转换为float的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我的代码有些问题。我试图使用< cstdlib>库和我试图在每个空白插槽转换字符串数据。我想如果你看到我的代码,你会得到我想要做的:

展开 | 选择 | Wrap | 行号

解决方案


好​​的,我的代码有些问题。我试图使用< cstdlib>库和我试图在每个空白插槽转换字符串数据。我想如果你看到我的代码,你会得到我想要做的:

展开 | 选择 | Wrap | 行号



另外,我不了解你,但我在谷歌上找不到strtof()。



那是因为它根本不存在。只有simmilar函数是strtod(),它将字符串转换为double。


Savage


好吧我试过你的两个建议但都没有工作....我认为这是因为它的工作空间不起作用。你能不能再看一遍我已经尝试了一切,我一直在收到错误消息...这里是我在尝试你的建议时得到的2:

-bash-3.00

Okay, Im having some problems with my code. Im trying to use the <cstdlib> library and im trying to convert string data at each whitespace slot. I think if you see my code you''ll get what im trying to do :

Expand|Select|Wrap|Line Numbers

解决方案

Okay, Im having some problems with my code. Im trying to use the <cstdlib> library and im trying to convert string data at each whitespace slot. I think if you see my code you''ll get what im trying to do :

Expand|Select|Wrap|Line Numbers


Also, I don''t know about you but I couldn''t find much about strtof() on Google.

Thats because it don''t exist at all.Only simmilar function is strtod() which converts string to double.

Savage


okay i tried both of your suggestions and neither worked....i think it''s because of the witespace that its not working. Can you please look at it again I''ve tried everything and i keep getting error mesages...here''s the 2 i got when i tried your suggestions:
-bash-3.00


这篇关于将文件的字符串转换为float的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆