Re: saving fileXXX.bmp

Liste des GroupesRevenir à l c 
Sujet : Re: saving fileXXX.bmp
De : fir (at) *nospam* grunge.pl (fir)
Groupes : comp.lang.c
Date : 26. Mar 2024, 12:59:28
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <utu9q9$33qfv$1@i2pn2.org>
References : 1 2 3 4 5 6 7 8
User-Agent : Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
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

Date Sujet#  Auteur
24 Mar 24 * saving fileXXX.bmp24fir
24 Mar 24 +* Re: saving fileXXX.bmp2Malcolm McLean
25 Mar 24 i`- Re: saving fileXXX.bmp1Mikko
24 Mar 24 +* Re: saving fileXXX.bmp14fir
24 Mar 24 i+* Re: saving fileXXX.bmp10jak
25 Mar 24 ii`* Re: saving fileXXX.bmp9fir
25 Mar 24 ii `* Re: saving fileXXX.bmp8jak
26 Mar 24 ii  `* Re: saving fileXXX.bmp7fir
26 Mar 24 ii   `* Re: saving fileXXX.bmp6fir
26 Mar 24 ii    `* Re: saving fileXXX.bmp5jak
27 Mar 24 ii     `* Re: saving fileXXX.bmp4fir
27 Mar 24 ii      `* Re: saving fileXXX.bmp3jak
27 Mar 24 ii       `* Re: saving fileXXX.bmp2fir
28 Mar 24 ii        `- Re: saving fileXXX.bmp1jak
25 Mar 24 i`* Re: saving fileXXX.bmp3Malcolm McLean
25 Mar 24 i `* Re: saving fileXXX.bmp2fir
25 Mar 24 i  `- Re: saving fileXXX.bmp1fir
25 Mar 24 `* Re: saving fileXXX.bmp7Mike Terry
25 Mar 24  `* Re: saving fileXXX.bmp6fir
25 Mar 24   `* Re: saving fileXXX.bmp5fir
26 Mar 24    +* Re: saving fileXXX.bmp3fir
26 Mar 24    i`* Re: saving fileXXX.bmp2fir
26 Mar 24    i `- Re: saving fileXXX.bmp1fir
28 Mar 24    `- Re: saving fileXXX.bmp1fir

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal