🔒 Locked
[.net] Reading From File Encoding Problem
Advertisement
Original Post
Hi there, I'm reading data from a file in XNA. More precisely a string that I convert in run-time to a float. The problem is that it cannot convert the string because of wrong format. The string is "4.0". When I change it to "4,0", it works. It has something to do with my local settings, I believe. I want it "4.0" as it is standard in English. How do I set this to work in the program no matter what settings a user has?
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;Again, this is on a per thread basis, and only works if you have the ControlThread SecurityPermission (which is generally true if the code is in your own application; may not be true if you're writing a library function that someone else calls).
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement