Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <utu9q9$33qfv$1@i2pn2.org>
Deutsch   English   Français   Italiano  
<utu9q9$33qfv$1@i2pn2.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder6.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail
From: fir <fir@grunge.pl>
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Tue, 26 Mar 2024 11:59:28 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <utu9q9$33qfv$1@i2pn2.org>
References: <utpl9q$2u0jk$1@i2pn2.org> <jKidnZQtQtYXfJ37nZ2dnZfqnPadnZ2d@brightview.co.uk> <utrbbd$30267$1@i2pn2.org> <zYicnXxWRq4OM5z7nZ2dnZfqn_ednZ2d@brightview.co.uk> <utsgmp$31pg0$1@i2pn2.org> <VdecnfVN_aK1bpz7nZ2dnZfqnPidnZ2d@brightview.co.uk> <utu2lg$33hth$1@i2pn2.org> <utu6ra$33mvr$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 26 Mar 2024 10:59:22 -0000 (UTC)
Injection-Info: i2pn2.org;
	logging-data="3271167"; mail-complaints-to="usenet@i2pn2.org";
	posting-account="+ydHcGjgSeBt3Wz3WTfKefUptpAWaXduqfw5xdfsuS0";
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
In-Reply-To: <utu6ra$33mvr$1@i2pn2.org>
X-Spam-Checker-Version: SpamAssassin 4.0.0
Bytes: 3053
Lines: 69

fir wrote:
> see the code for list (by design i invented working on sickle.c -
> those name convention for this list is not yet quite clear as i
> generally variables and arrays wrote lettercase but here this
> list im not so sure so i used pascals
>
>
> void StrCopyMaxNBytes(char* dest, char* src, int n)
> {
>    for(int i=0; i<n; i++) { dest[i]=src[i]; if(!src[i]) break;  }
> }
>
>
>   //list
>
>   const int FileNameListEntry_name_max = 500;
>   struct FileNameListEntry { char name[FileNameListEntry_name_max]; };
>
>   FileNameListEntry* FileNameList = NULL;
>   int FileNameList_Size = 0;
>
>   void FileNameList_AddOne(char* name)
>   {
>       FileNameList_Size++;
>       FileNameList = (FileNameListEntry*) realloc(FileNameList,
> FileNameList_Size * sizeof(FileNameListEntry) );
>       StrCopyMaxNBytes((char*)&FileNameList[FileNameList_Size-1].name,
> name, FileNameListEntry_name_max);
>       return ;
>   }
>

ok so to the addtion of container code above this work

  WIN32_FIND_DATA ffd;

  void ReadDIrectoryFileNamesToList(char* dir)
  {
   HANDLE h = FindFirstFile(dir, &ffd);
   if(!h) ERROR_EXIT("error reading directory");

   do  {
    if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
      FileNameList_AddOne(ffd.cFileName);
   }
   while (FindNextFile(h, &ffd));

  }



int main(void)
{
//  ReadDIrectoryFileNamesToList("C:\\*");
   ReadDIrectoryFileNamesToList("*");

   for(int i=0; i< FileNameList_Size; i++)
       printf("\n %d %s", i, FileNameList[i].name );

   return 'ok';
}

so i got all teh names in list ..eventually i could sort it hovever i 
got bad experiences with my sorting routine

back then i wanted to revrite quicksort to be as simpel as possible and 
cookd a form that had an error but lost the ability to say which of the 
form is correct so i had a sort of quicksort trauma now