AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Is there any way to open all files from a folder one by one? (https://forums.alliedmods.net/showthread.php?t=183294)

NucL3ra 04-20-2012 09:16

Is there any way to open all files from a folder one by one?
 
Title says it all...

I have a folder called 'Folder' with 5 files : 1.txt, 2.txt, 3.ini, 4.vault, 5.hi
Is there any way I can detect them and them open them one by one ? (with fopen)

Exolent[jNr] 04-20-2012 09:42

Re: Is there any way to open all files from a folder one by one?
 
Code:
new const dir[] = "addons/amxmodx/configs" new file[32], path[64]; new d = open_dir(dir, file, charsmax(file)); new f do {     // check for '.' and '..' files     if(file[0] == '.' && (!file[0] || file[1] == '.' && !file[2])) {         continue;     }         formatex(path, charsmax(path), "%s/%s", dir, file);         f = fopen(path, "rt");         if(f) {         // read                 fclose(f);     } } while(next_file(d, file, charsmax(file)); close_dir(d);


All times are GMT -4. The time now is 07:48.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.