Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,161 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Enumerate with file_next over filenames in directory #484884
12/25/21 16:44
12/25/21 16:44
Joined: Dec 2021
Posts: 7
B
budfox Offline OP
Newbie
budfox  Offline OP
Newbie
B

Joined: Dec 2021
Posts: 7
Hi,

currently I am trying to modify the script CSVtoHistory and transform multiple csv files at the same time.

In the manual I found the method file_next(string name) to access the filenames in a directory. The description points out that it can be used to loop well over the filenames in a directory.

Unfortunately, I haven't figured out how to access the next filename in each case, but always get only the first filename in the directory. Does anyone have a suggestion for a solution?

See below my current attempt to get the filenames...


Code

function main() 
{
	int i;
	for (i = 0; i < 10; i++) {
	
	string Name = file_next("CollectedHistory\\*.csv");
	printf("Der Filename lautet: %s \n", Name);
	
	}
}


Re: Enumerate with file_next over filenames in directory [Re: budfox] #484885
12/25/21 17:20
12/25/21 17:20
Joined: Dec 2021
Posts: 7
B
budfox Offline OP
Newbie
budfox  Offline OP
Newbie
B

Joined: Dec 2021
Posts: 7
I figured it out after trying some more and thought that might be of interest to others.

Code
function main() 
{
	int i;
	for (i = 0; i < 10; i++) {
		
		printf("i ist %i", i);
		if (i == 0) {
			string Name = file_next("CollectedHistory\\*.csv");
			printf("Der Filename lautet: %s \n", Name);
		} 
		else {
			string Name = file_next(0);
			printf("Der Filename lautet: %s \n", Name);
		}
		
	}
}

Re: Enumerate with file_next over filenames in directory [Re: budfox] #485615
03/31/22 11:35
03/31/22 11:35
Joined: Mar 2022
Posts: 21
Frankfurt am Main
B
BrainSailor Offline
Newbie
BrainSailor  Offline
Newbie
B

Joined: Mar 2022
Posts: 21
Frankfurt am Main
Thanks for sharing! I was having the same issue! laugh


Moderated by  Petra 

Gamestudio download | 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