Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 728 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 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