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 / loading and saving files in DarkGDK

Author
Message
FIRESTORM 000
16
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 4th Feb 2009 04:45
I've looked through the help files and several pages of these forums, but I can't find anything that works for me.

I need to save various pieces of data, mostly arrays to a file. I tried the basic commands included with DarkGDK, but they did not work for some reason. I also tried both ways shown here, but they didn't work either.

I'm at a total loss. Thanks in advance for any help.
puppyofkosh
17
Years of Service
User Offline
Joined: 9th Jan 2007
Location:
Posted: 4th Feb 2009 12:53 Edited at: 4th Feb 2009 12:53
I believe you should have a header file called fsstream. (If not you can probably get it somewhere).

That might solve your problems.
Hayer
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 4th Feb 2009 13:03
Well, what are u trying to do?

Write plain text to a file and then read it again?

Lil Joe
16
Years of Service
User Offline
Joined: 31st Jul 2008
Location: Cluj
Posted: 4th Feb 2009 16:45
I got the same problem, I can't read from .txt files. Atm it's just plain text
FIRESTORM 000
16
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 4th Feb 2009 23:12 Edited at: 5th Feb 2009 00:28
Quote: "Well, what are u trying to do?

Write plain text to a file and then read it again?"


basically yes. I need to be able to write a save file including multiple variables, and then read it on a future play-through. Preferably, the data stored would not be readable in a text editor.

Also, I've played around with different include files to see what works and what doesn't, and several of the basic C++ header files stop the game from compiling successfully when included. For example, the include needed for strings. Am I doing something wrong with these that could be the source of my problem?
includes that stop the game from compiling:
#include <istream>
#include <iostream>
#include <string>

Quote: "I believe you should have a header file called fsstream."

I don't seem to have that file. what does it do anyhow?
Lil Joe
16
Years of Service
User Offline
Joined: 31st Jul 2008
Location: Cluj
Posted: 5th Feb 2009 10:02
Quote: "I don't seem to have that file. what does it do anyhow?"

fstream.h is for reading and writing into files and it's realy easy to use. But I can't load this header file when I include the DarkGDK.h file

If someone knows how to use C++ Libraries and DarkGDK.h at the same time pls tell me
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 5th Feb 2009 16:30
Quote: "includes that stop the game from compiling:
#include <istream>
#include <iostream>
#include <string>"


Assuming you're compiling in debug mode, try switching to release mode and see it the compile will go through.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Lil Joe
16
Years of Service
User Offline
Joined: 31st Jul 2008
Location: Cluj
Posted: 5th Feb 2009 18:03
Quote: "[quote]includes that stop the game from compiling:
#include <istream>
#include <iostream>
#include <string>"
Assuming you're compiling in debug mode, try switching to release mode and see it the compile will go through.[/quote]

IT WORKS many thanks
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 5th Feb 2009 18:24
It's a common problem when you include portions of the std library. Dark GDK doesn't have a debug version so it can't find the link.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
FIRESTORM 000
16
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 6th Feb 2009 04:48
Quote: "Assuming you're compiling in debug mode, try switching to release mode and see it the compile will go through."


Well, now my code compiles, but it returns a memory access violation whenever I try to read data from a file. writing works fine, but reading crashes the program. Thoughts?

If it makes a difference, the file is not read only, and I have full admin rights. (running vista)
andiconda
15
Years of Service
User Offline
Joined: 10th Feb 2009
Location:
Posted: 10th Feb 2009 19:00
yea the only c++ libs you can use really is
stdio (which is pre-included by default)
dark gdk refers to other libraries causing conflicts when including them.
sudjestions:
make a dll (i don't know much bout them) but i think you can treat them almost like header files. you can have it run independent of dark, you use a function called dbCallDLL (or something like that i don't remember, its in the manual)

header files i believe will conflict due to inheritance of libs (haven't tinkered with it too much so not 100% certain there is a way around it)

you can make a class object.
these don't inherit, they are almost like seperate programs called by your program. (helps if you know a bit about object oriented programming)



if you are getting a memory access violation, well did the compiler say like continue debug or break
if so hit continue

another idea would be to go to your debug or release folder and transfer the .exe to your project folder (ProjectName\projectname)
i think the directory access on dark causes conflicts with vista's defense mechanisms.

i would get an error whenever compiling because i would access a .pk3 file that was in my project directory but my exe was not running in the project directory (it was in the debug)
vista thinks that someone is trying to change data against your will and will crash your program.

i hope some of that helped

Login to post a reply

Server time is: 2024-11-25 13:40:57
Your offset time is: 2024-11-25 13:40:57