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
2 registered members (degenerate_762, Nymphodora), 1,012 guests, and 3 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
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: 17
Frankfurt am Main
B
BrainSailor Offline
Newbie
BrainSailor  Offline
Newbie
B

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


Moderated by  Petra 

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