0 votes

I'm trying to extract from a file a float and an int
for the float I have nothing in return and for the int wrong values in 8,16,32 bits

a file;


func chargement_fichier():
file = File.new()
file.open("/Users/pat 1/Desktop/manglais.txt",File.READ)

vers = file.get_float()
nbrenr = file.get_8()

I'm looking for examples
Thank you.

in Engine by (27 points)

1 Answer

0 votes

The get_float() and get_8() methods are for getting binary stored data. Your file is obviously a text file. So just read the strings with get_line() and assign them to your variables.


by (3,358 points)

of course !! .. yes load them in 'string' to convert them to 'int'
thank you for waking me up :-)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.