Re: saving fileXXX.bmp

Liste des GroupesRevenir à l c 
Sujet : Re: saving fileXXX.bmp
De : malcolm.arthur.mclean (at) *nospam* gmail.com (Malcolm McLean)
Groupes : comp.lang.c
Date : 24. Mar 2024, 19:34:25
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <utpo73$g827$1@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
On 24/03/2024 16:44, 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)
That should work. Tty to open painting001,bmp for reading. If the function succeeds, then obviously the file exists, so try painting002.bmp, painting300 and so on, until eventually you must find one whuch fails. Either the file doesn't exist, or there is something funny with it. So try to open painting500.bmp for writing. If it fails, then unless you are out of disk space, there probably was a painting500,bmp file with someting funny with it, so increement again. If it works, then write file.
It should be pretty robust, except that Microsoft have been breaking standard library calls like fopen.
To write the bmp file itself with just fopen, raid
https://github.com/MalcolmMcLean/babyxrc
and take bmp.c, bmp.h. Check the docs at.
http://malcolmmclean.github.io/babyxrc/sourcefiles.html
--
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm

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