Re: saving fileXXX.bmp

Liste des GroupesRevenir à cl c  
Sujet : Re: saving fileXXX.bmp
De : fir (at) *nospam* grunge.pl (fir)
Groupes : comp.lang.c
Date : 25. Mar 2024, 10:24:38
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <utrcca$303ce$1@i2pn2.org>
References : 1 2 3 4
User-Agent : Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
fir wrote:
Malcolm McLean wrote:
On 24/03/2024 21:26, fir wrote:
fir wrote:
i want to save bitmap (when using editor) but i dont wannt
to pen a dialog for saving ui just wana do quicksave but not replace
the file already exist so i want to maybe use such scheme i will sawe
>
"painting001.bmp" and if there is such number i will just increase
the number to 002 if such exist i will use 003 and so on
>
do yu thing it is standable to use c std lib (and probably just
fopen fclose to detect if that file already exist of there is a need
to use some specific windows functions?
>
i never used it though - though maybe i could becouse code
that is able to walk on directories and read all files may be handy
for various practical usage (liek finding something , removing
duplicates etc)
>
the question is if if somoene would work longer and had 1000 bitmaps
in folder if this will not slow down, or still be fast etc...could check
experimentally but even then i wouldnt be sure if this is kinda
optimal or wastefull way
>
Opening a file is rather a slow operation. But not so slow on most
platforms. Of course there will come a point where the approach is
simply too slow. But for saving human-generated bitmaps I don't think
you'll test the limits.
>
>
but if you open 1000th ypu need to try-open 999 which im not sure is
okay or not ...im not sure if this opening is like read a directory data
  and localise this name in it or it is more heavy and also involves
something heavier
>
for safety it rather means i should possibly read on api to read
directory files list better (which probably is also easy as i may just
google it)
>
but i will see yet
>
i found the article
https://learn.microsoft.com/en-us/windows/win32/fileio/listing-the-files-in-a-directory
if skipping the microsoft 'jargon' (which i also destaste as many)
it seems that i may use
  WIN32_FIND_DATA ffd;  //for file info i guess
typedef struct _WIN32_FIND_DATAA {
   DWORD    dwFileAttributes;
   FILETIME ftCreationTime;
   FILETIME ftLastAccessTime;
   FILETIME ftLastWriteTime;
   DWORD    nFileSizeHigh;
   DWORD    nFileSizeLow;
   DWORD    dwReserved0;
   DWORD    dwReserved1;
   CHAR     cFileName[MAX_PATH];
   CHAR     cAlternateFileName[14];
   DWORD    dwFileType; // Obsolete. Do not use.
   DWORD    dwCreatorType; // Obsolete. Do not use
   WORD     wFinderFlags; // Obsolete. Do not use
} WIN32_FIND_DATAA, *PWIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
then hFind = FindFirstFile(szDir, &ffd);
and
  do
    {
       if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
       {
       }
       else
       {
       }
    }   while (FindNextFile(hFind, &ffd) != 0);
at least ms uses pascal function names as i do the rest of the jargon is not my - i could think is using all bigcase for kinda enims/consts is acceptable but i probbaly will stay in a way i do it it is variables
i write lowcase
they use 64 bit ints format and i so rarely use it i forgot which is best for me though possibly i use LARGE_INTEGER (also ms one)

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