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 / saving some data to a file does not work - dbWriteString

Author
Message
Pong303
13
Years of Service
User Offline
Joined: 29th Jul 2011
Location:
Posted: 13th Sep 2011 19:53
Hi,

im trying to save player names and points to a file. It does not work like expected. Maybe there is a mistake in the code but i dont get it. Do you have an idea?

The char player1Name is defined in another function. For example "MAX"...



The containment of a existing file could be:

"TOM|200|PETER|300"

After calling saveName() the containment should be

"TOM|200|PETER|300|MAX|0"


The result is:

" TOM|200|PETER|300|MAX|0" ( <-- char one is a space!)

after a secound try:

" |MAX|0"

instead of "TOM|200|PETER|300|MAX|0|MAX|0" ......

Appart from the problem it doesnt work... Is there a better way to code this? I would like to append the new text to the end of the file, but there isnt a db-function for this, is there?

I would try to write the code with fstream and iostream functions but i get an error. I cant include the librarys... Someone else had this problem before in this forum, but there was not really a solution.

Daniel
Pong303
13
Years of Service
User Offline
Joined: 29th Jul 2011
Location:
Posted: 14th Sep 2011 00:46
Now i have found the answer on the fstream problem in another thread:

you will need to go to menu -> project -> <projectname> properties -> configuration properties -> C/C++ -> code generation and set runtime library to /MT

thx@Hassan

I will try to make this run with this lib.

Daniel

Login to post a reply

Server time is: 2024-10-02 19:27:42
Your offset time is: 2024-10-02 19:27:42