Ensuring same locale for reading/writing

Hi, My original question comes from Random library but I guess it is not strictly Random-related. I would like to save a state of pseudo-random number generator and then restore it on different machine with potentially different locale. Random docs say tho: "The state shall be written in a platform-independent manner, but it is assumed that the locales used for writing and reading be the same." How do I assure same locale on all machines / platforms? Or more directly: how do I assure portable save/restore. -- Szymon Gatner The Lordz Games Studio www.thelordzgamesstudio.com

AMDG On 06/22/2011 07:51 AM, Szymon Gatner wrote:
My original question comes from Random library but I guess it is not strictly Random-related.
I would like to save a state of pseudo-random number generator and then restore it on different machine with potentially different locale. Random docs say tho:
"The state shall be written in a platform-independent manner, but it is assumed that the locales used for writing and reading be the same."
How do I assure same locale on all machines / platforms? Or more directly: how do I assure portable save/restore.
I would probably imbue the stream with std::locale::classic(). In Christ, Steven Watanabe

2011/6/22 Steven Watanabe
AMDG
On 06/22/2011 07:51 AM, Szymon Gatner wrote:
My original question comes from Random library but I guess it is not strictly Random-related.
I would like to save a state of pseudo-random number generator and then restore it on different machine with potentially different locale. Random docs say tho:
"The state shall be written in a platform-independent manner, but it is assumed that the locales used for writing and reading be the same."
How do I assure same locale on all machines / platforms? Or more directly: how do I assure portable save/restore.
I would probably imbue the stream with std::locale::classic().
Thanks, I will do that. Cheers, Szymon -- Szymon Gatner The Lordz Games Studio www.thelordzgamesstudio.com
participants (2)
-
Steven Watanabe
-
Szymon Gatner