Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Nymphodora, Quad), 919 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[SOLVED] File_str_readto with char* pointer #462626
10/17/16 11:28
10/17/16 11:28
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Howdy,

I want to use a char* pointer for file_str_readto function so I can read-out larger text files (correct me if I misunderstood that).
But I can't seem to get it working with char*. What I basically want to do is read the large text file line by line.

This is what I had when using a STRING* to read the lines:
Code:
function read_line(var fHnd) {
	str_cpy(tmp_str, ""); //reset previous read lines
	file_str_readto(fHnd, tmp_str, "\n", 999999); //read next line
	str_trim(tmp_str); //remove spaces from value
	str_trunc(tmp_str, 1); //remove \n (/remove delimiter)
}



How to change it so file_str_readto use a char* instead of a STRING* and than copy's that read line to the STRING* ?
(I am mainly having difficulties resetting the char* and converting that 1 line to STRING*)

Thanks for taking the time.

Last edited by Reconnoiter; 10/17/16 19:01.
Re: File_str_readto with char* pointer [Re: Reconnoiter] #462640
10/17/16 17:04
10/17/16 17:04
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,
as far as I understand from the manual the 10K characters limit applies to the resulting string, not the whole file size. If your text lines are shorter it should not be problems at all, I guess. Are your text lines longer than 10K characters? crazy

Re: File_str_readto with char* pointer [Re: txesmi] #462643
10/17/16 19:10
10/17/16 19:10
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Hi txesmi, tnx for replying, I know what it is now. I added a periodic wait to the function cause the engine can't create >1000 objects with an initialization action at the same time. But in doing so I forgot that in an other function the file got closed. grin blush
Sry for the confusion. Also I pleasantly suprised in the loading speed from a text file, seems only ent_create really eats some fps away which is to be expected with e.g. 2500 ents.

offtopic: by the way do you also have any game projects your are currently working on or planning on to release? I would be interested to see what you can make. wink

Last edited by Reconnoiter; 10/17/16 19:12.
Re: File_str_readto with char* pointer [Re: Reconnoiter] #462663
10/19/16 14:07
10/19/16 14:07
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Originally Posted By: Reconnoiter
are currently working on or planning on to release?

Not really, I always lacked the necessary artist. frown

I am looking forward!

Re: File_str_readto with char* pointer [Re: txesmi] #462674
10/19/16 19:23
10/19/16 19:23
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Yeah that is an annoying one. You can try to buy some assets, sometimes they have good deals. But the conversion progress can be a pain (still a time saver for complex models).

Re: File_str_readto with char* pointer [Re: Reconnoiter] #462681
10/20/16 05:10
10/20/16 05:10
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Yes, its a pain. I always got stuck on art part. I recently knew a draftsman interested on game development but he has to learn tons of things and we only meet a couple of times a month. Snail rythm but hopefull grin


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1