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 / Read File

Author
Message
Rims Flames
10
Years of Service
User Offline
Joined: 5th Apr 2014
Location:
Posted: 17th Sep 2014 01:43
Hi guyz,

Can you please give me an example on how can i simply open to read a file and read it's strings?

Thank You very much!

Rims Flames
s_i
15
Years of Service
User Offline
Joined: 23rd May 2009
Location: Russia
Posted: 17th Sep 2014 22:40
No problems!

1) carefully read this: http://forum.thegamecreators.com/?m=forum_view&t=161373&b=22

2) then read this: http://forum.thegamecreators.com/?m=forum_view&t=198239&b=22

and this: http://forum.thegamecreators.com/?m=forum_view&t=179660&b=22

3) other useful info about fstream is in attachment.

Attachments

Login to view attachments
Rims Flames
10
Years of Service
User Offline
Joined: 5th Apr 2014
Location:
Posted: 19th Sep 2014 00:19
Thank you, i read that, but is very hard for me to understand that...do you have just a basic example on how to read a couple of strings from a file?

Thank You!

Rims Flames
s_i
15
Years of Service
User Offline
Joined: 23rd May 2009
Location: Russia
Posted: 19th Sep 2014 18:39
No problems!

VERY simple example with DarkGDK. I wrote it special for you.

Rims Flames
10
Years of Service
User Offline
Joined: 5th Apr 2014
Location:
Posted: 19th Sep 2014 20:12
A big thank you for this example s_i i really appreciate it! You saved my project.

Rims Flames
Rims Flames
10
Years of Service
User Offline
Joined: 5th Apr 2014
Location:
Posted: 19th Sep 2014 20:26
I merged the code to fit with my project, i had set display mode enabled and with your help my application reads from the file, but i am running in a little problem, i don't know why it says display mode not supported as the error, my application is attached to a panel from an interface made in C#, and the interface eliminates a file with the size of the panel and then the app reads it. Do you know what's happening?

Thank You very very much!



Rims Flames
s_i
15
Years of Service
User Offline
Joined: 23rd May 2009
Location: Russia
Posted: 19th Sep 2014 21:07 Edited at: 19th Sep 2014 21:13
No problems!



or better way:

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 19th Sep 2014 22:48 Edited at: 19th Sep 2014 22:53
Just for the record, here's the C++ STL implementation for a little more tidiness



std::string is a memory safe dynamically allocated string. You can use it just like you used it in DBP.

You can get a const char* from an std::string with:


But because DarkGDK failed to be const correct, dbText() accepts only a char*, so you are forced to cast away the qualifiers:


That gets a little ugly I suppose, but it's not your fault. Alternately, you can copy the string into a buffer before printing it, just like what you'd do with integers:



I like offending people. People who get offended should be offended. -- Linux Torvalds
Rims Flames
10
Years of Service
User Offline
Joined: 5th Apr 2014
Location:
Posted: 20th Sep 2014 01:09
It worked thank you very much! s_i and TheComet!

Rims Flames

Login to post a reply

Server time is: 2024-11-18 21:32:14
Your offset time is: 2024-11-18 21:32:14