Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 05:41
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AbrahamR, AndrewAMD), 1,278 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Build a list of all CSV files #448411
02/04/15 00:55
02/04/15 00:55
Joined: Jan 2015
Posts: 5
Y
YoungPete Offline OP
Newbie
YoungPete  Offline OP
Newbie
Y

Joined: Jan 2015
Posts: 5
I'm wanting to build a list of all CSV files. The list will do a recursive find on a particular path. Will this do the job, are are there more recent libraries to glean from ?

Code:
#include <acknex.h>
#include <windows.h>
#include <stdio.h>

typedef struct _FILETIME {
  DWORD dwLowDateTime;
  DWORD dwHighDateTime;
} 
_FILETIME; 

typedef struct _WIN32_FIND_DATA {
  DWORD dwFileAttributes;
  FILETIME ftCreationTime;
  FILETIME ftLastAccessTime;
  FILETIME ftLastWriteTime;
  DWORD nFileSizeHigh;
  DWORD nFileSizeLow;
  DWORD dwReserved0;
  DWORD dwReserved1;
  char cFileName[ MAX_PATH ];
  char cAlternateFileName[ 14 ];
} 
_WIN32_FIND_DATA;

char main_str[10000];

int list_files(char *dir)
{
   HANDLE main_handle;
   WIN32_FIND_DATA main_data;
   char path_str[500];

   main_handle = FindFirstFile(dir,&main_data);
   
   while(FindNextFile(main_handle,&main_data))
   {
      switch(main_data.dwFileAttributes)
      {
         case FILE_ATTRIBUTE_DIRECTORY:
            sprintf(main_str,"[dir]");
            sprintf(main_str,main_data.cFileName);
            sprintf(main_str,"\n");
            GetFullPathName(main_data.cFileName,path_str,4096,NULL);
            list_files(path_str);
            break;
         default:
            sprintf(main_str,"[file]");
            sprintf(main_str,main_data.cFileName);
            sprintf(main_str,"\n");
      }
	}      
}

int main()
{
   wait(1);
   list_files("Data\\*.csv");
}



I only have Zorro at present, but wanted to use Lite-C. Found a link to download Lite-C (http://server.conitec.net/down/gstudio_setup.exe) but it didn't work. Downloaded Gamestudio 8 as a free version. Tried the code above, compiled okay, but then got an error - "Error E1241 Can't open DirectX device".

Thanks,

Pete

Last edited by YoungPete; 02/04/15 03:59.
Re: Build a list of all CSV files [Re: YoungPete] #448415
02/04/15 08:22
02/04/15 08:22
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
in gamestudio we use txt_for_dir for this purpose, that creates STRINGs containing all file names according to the given STRING filter, within the given TEXT.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Build a list of all CSV files [Re: sivan] #448431
02/04/15 23:52
02/04/15 23:52
Joined: Jan 2015
Posts: 5
Y
YoungPete Offline OP
Newbie
YoungPete  Offline OP
Newbie
Y

Joined: Jan 2015
Posts: 5
Thanks, have found the documentation for it at http://www.conitec.net/beta/txt_for_dir.htm


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