Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Writing structure to file?

Author
Message
Murloc
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location: Utena,Lithuania
Posted: 11th Apr 2009 00:15
At the moment I have such a problem, I want to write contents of struct to a file, got read some topics covering this in the internet(google) but still it makes some troubles.

What I'm doing:

Implementing my struct:


Adding a child one,assigning values:


Opening a filestream,file,writing,closing:


But what I get in file is not what I want. Some variety of symbols.

So I am asking for assistance in this, how to write contents of the struct in file?

Theory-When you know everything,but nothing works.
Practice-When everything works,but you don't know why.
Programming merges these two-Nothing works,and you don't know why.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 11th Apr 2009 00:39
@Murloc
When written to a file, that struct WILL look like a variety of symbols, and without converting and saving each member individually, that's all you're going to get.

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
Murloc
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location: Utena,Lithuania
Posted: 11th Apr 2009 00:46
Ohh... Damn I wasn't notified about this

So it should be possible to read it back like so too?

Theory-When you know everything,but nothing works.
Practice-When everything works,but you don't know why.
Programming merges these two-Nothing works,and you don't know why.
Murloc
15
Years of Service
User Offline
Joined: 28th Dec 2008
Location: Utena,Lithuania
Posted: 11th Apr 2009 00:54 Edited at: 11th Apr 2009 00:55
Ohh I managed to read it back, sweet! Kinda encrypt for free

No further help needed.

Theory-When you know everything,but nothing works.
Practice-When everything works,but you don't know why.
Programming merges these two-Nothing works,and you don't know why.
AlexI
19
Years of Service
User Offline
Joined: 31st Dec 2004
Location: UK
Posted: 11th Apr 2009 01:30 Edited at: 11th Apr 2009 01:31
Quote: "Kinda encrypt for free"


Someone else could just right a program and load your structure to They could then even modify it and save over it again

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 11th Apr 2009 18:40
And char strings will be visible in plain text.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office

Login to post a reply

Server time is: 2024-09-30 23:29:46
Your offset time is: 2024-09-30 23:29:46