Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

She won' go Warp 7, Cap'n! The batteries are dead!


devel / comp.lang.c / saving fileXXX.bmp

SubjectAuthor
* saving fileXXX.bmpfir
+* Re: saving fileXXX.bmpMalcolm McLean
|`- Re: saving fileXXX.bmpMikko
+* Re: saving fileXXX.bmpfir
|+* Re: saving fileXXX.bmpjak
||`* Re: saving fileXXX.bmpfir
|| `* Re: saving fileXXX.bmpjak
||  +- Re: saving fileXXX.bmpScott Lurndal
||  `* Re: saving fileXXX.bmpfir
||   `* Re: saving fileXXX.bmpfir
||    `* Re: saving fileXXX.bmpjak
||     `* Re: saving fileXXX.bmpfir
||      `* Re: saving fileXXX.bmpjak
||       `* Re: saving fileXXX.bmpfir
||        `- Re: saving fileXXX.bmpjak
|`* Re: saving fileXXX.bmpMalcolm McLean
| `* Re: saving fileXXX.bmpfir
|  `- Re: saving fileXXX.bmpfir
`* Re: saving fileXXX.bmpMike Terry
 `* Re: saving fileXXX.bmpfir
  `* Re: saving fileXXX.bmpMike Terry
   `* Re: saving fileXXX.bmpfir
    `* Re: saving fileXXX.bmpMike Terry
     +* Re: saving fileXXX.bmpfir
     |`* Re: saving fileXXX.bmpfir
     | `- Re: saving fileXXX.bmpfir
     `- Re: saving fileXXX.bmpfir

Pages:12
saving fileXXX.bmp

<utpl9q$2u0jk$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34720&group=comp.lang.c#34720

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: saving fileXXX.bmp
Date: Sun, 24 Mar 2024 17:44:48 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <utpl9q$2u0jk$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Mar 2024 16:44:42 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3080820"; 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
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: fir - Sun, 24 Mar 2024 16:44 UTC

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)

Re: saving fileXXX.bmp

<utpo73$g827$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34724&group=comp.lang.c#34724

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Sun, 24 Mar 2024 17:34:25 +0000
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <utpo73$g827$1@dont-email.me>
References: <utpl9q$2u0jk$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Mar 2024 17:34:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7b5290fcf73ca0e61ae80974ef0f676d";
logging-data="532551"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19u8y6cKt0MfDLpmWMcVyX2+KBJlmg7UZA="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ohTGQaLvDaOdZS9XgJhf4vVdCGg=
In-Reply-To: <utpl9q$2u0jk$1@i2pn2.org>
Content-Language: en-GB
 by: Malcolm McLean - Sun, 24 Mar 2024 17:34 UTC

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

Re: saving fileXXX.bmp

<utq5qj$2ummn$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34734&group=comp.lang.c#34734

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Sun, 24 Mar 2024 22:26:49 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <utq5qj$2ummn$1@i2pn2.org>
References: <utpl9q$2u0jk$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Mar 2024 21:26:43 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3103447"; 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: <utpl9q$2u0jk$1@i2pn2.org>
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: fir - Sun, 24 Mar 2024 21:26 UTC

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

Re: saving fileXXX.bmp

<utq6qd$jtaq$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34736&group=comp.lang.c#34736

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nos...@please.ty (jak)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Sun, 24 Mar 2024 22:43:39 +0100
Organization: A noiseless patient Spider
Lines: 69
Message-ID: <utq6qd$jtaq$1@dont-email.me>
References: <utpl9q$2u0jk$1@i2pn2.org> <utq5qj$2ummn$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Mar 2024 22:43:41 +0100
Injection-Info: dont-email.me; posting-host="52cb0f91b2aa888bbb146d112670bd02";
logging-data="652634"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Dr2f7LFbjs1X6B30S+1uu"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:k4I9fSaNqsFfByXNVMV7oBedB5M=
In-Reply-To: <utq5qj$2ummn$1@i2pn2.org>
 by: jak - Sun, 24 Mar 2024 21:43 UTC

fir ha scritto:
> 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

In order not to manage too many differences between compilers you could
try this way:

#include <stdio.h>
#include <limits.h>

int main()
{ char pref[50] = "bmp_file_",
cmd[1024],
str[PATH_MAX];
int seq;
FILE *fp, *f;

sprintf(cmd, "c:\\windows\\system32\\cmd.exe /c dir /b /o:-n %s???
2>nul", pref);

if((fp = popen(cmd, "rt")) != NULL)
{
if(fgets(str, PATH_MAX, fp) != NULL)
{
sscanf(str, "%[^0-9]%3d%*", pref, &seq);
sprintf(str, "%s%03d", pref, ++seq);
}
else
sprintf(str, "%s%03d", pref, 1);

pclose(fp);

if((f = fopen(str, "r")) == NULL)
{
if((f = fopen(str, "w")) == NULL)
printf("cannot create %s", str);
}
else
printf("%s already exist", str);

if(f != NULL) fclose(f);
}
else
printf("cannot open process");

return 0;
}

This piece of code is only used to give the idea and is not well tested.

Re: saving fileXXX.bmp

<utqcru$l76t$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34743&group=comp.lang.c#34743

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: malcolm....@gmail.com (Malcolm McLean)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Sun, 24 Mar 2024 23:26:53 +0000
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <utqcru$l76t$1@dont-email.me>
References: <utpl9q$2u0jk$1@i2pn2.org> <utq5qj$2ummn$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 25 Mar 2024 00:26:55 +0100
Injection-Info: dont-email.me; posting-host="89cda9b5b060c3bbdaaa3b408f28574f";
logging-data="695517"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18vBuh5OWnb1qwtpCtSJfVsWQonBgvRVd0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:bgFwYmh4IPQ3MMmL4kI3suLCG6U=
In-Reply-To: <utq5qj$2ummn$1@i2pn2.org>
Content-Language: en-GB
 by: Malcolm McLean - Sun, 24 Mar 2024 23:26 UTC

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.

--
Check out Basic Algorithms and my other books:
https://www.lulu.com/spotlight/bgy1mm

Re: saving fileXXX.bmp

<jKidnZQtQtYXfJ37nZ2dnZfqnPadnZ2d@brightview.co.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34747&group=comp.lang.c#34747

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!69.80.99.23.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 25 Mar 2024 02:29:30 +0000
Subject: Re: saving fileXXX.bmp
Newsgroups: comp.lang.c
References: <utpl9q$2u0jk$1@i2pn2.org>
From: news.dea...@darjeeling.plus.com (Mike Terry)
Date: Mon, 25 Mar 2024 02:29:33 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.17
MIME-Version: 1.0
In-Reply-To: <utpl9q$2u0jk$1@i2pn2.org>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <jKidnZQtQtYXfJ37nZ2dnZfqnPadnZ2d@brightview.co.uk>
Lines: 43
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-HHysycvHrdUpTBp/Gzpb3Zn20Ch1XBUQEIt/mYop9VrJE4vkmNJ5LKXICEMLJPxPCfg3l/mlRTCuCb4!K5Prsh0cHkmQrrJitahDKZjeoNn/6zcY0hTSERpRkmwmUk7MNmmioLGzrex+0lU99IUyEwMM9/iJ!ezaHGvF11Jchnx/vr6VrfZV4DryO
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Mike Terry - Mon, 25 Mar 2024 02:29 UTC

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)

I think the bigger issue is where to create such files? If users have used your app to open some
existing .bmp file for processing, it's quite possible they won't have write access to that folder.
In that case a Save or Save As operation should trigger a standard file system file select dialog in
a GUI program which is fair enough, but it sounds like you want to create a temp file with no user
intervention? Command line utilities often have some kind of "temp folder" option.

Ideas to consider:
- tmpfile() (POSIX?]
- GetTempFileName(), GetTempPath() [Windows]
- Use environment variables like TMP/TEMP? (Possibly different usage on different platforms)
- how to clean up such temp files so they don't pollute the file system long term?
- ensuring uniqueness? [e.g. if multiple copies of your program are running at the same time]
(Your idea is ok on this front, provided:
* only one process can create the temp file and
* a second open attempt with the same name will fail, and
* your logic has a loop to recognise such failures and try again with a
new name etc..
Note GetTempFileName() fails on this front...)
- Other filename ideas : including timestamps or GUIDs or PIDs in the filename, but by
themselves those may not fully solve uniqueness problem.
- Listing the directory to generate available filenames might be more
efficient in some usage cases, especially if the API includes file filter options.

Above aren't really C issues, so there are better places to discuss them.

Mike.

Re: saving fileXXX.bmp

<utrbbd$30267$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34748&group=comp.lang.c#34748

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Mon, 25 Mar 2024 09:07:01 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <utrbbd$30267$1@i2pn2.org>
References: <utpl9q$2u0jk$1@i2pn2.org> <jKidnZQtQtYXfJ37nZ2dnZfqnPadnZ2d@brightview.co.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 25 Mar 2024 08:07:10 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3147975"; 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: <jKidnZQtQtYXfJ37nZ2dnZfqnPadnZ2d@brightview.co.uk>
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: fir - Mon, 25 Mar 2024 08:07 UTC

Mike Terry wrote:
> 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)
>
> I think the bigger issue is where to create such files? If users have
> used your app to open some existing .bmp file for processing, it's quite
> possible they won't have write access to that folder. In that case a
> Save or Save As operation should trigger a standard file system file
> select dialog in a GUI program which is fair enough, but it sounds like
> you want to create a temp file with no user intervention? Command line
> utilities often have some kind of "temp folder" option.
>
> Ideas to consider:
> - tmpfile() (POSIX?]
> - GetTempFileName(), GetTempPath() [Windows]
> - Use environment variables like TMP/TEMP? (Possibly different usage
> on different platforms)
> - how to clean up such temp files so they don't pollute the file system
> long term?
> - ensuring uniqueness? [e.g. if multiple copies of your program are
> running at the same time]
> (Your idea is ok on this front, provided:
> * only one process can create the temp file and
> * a second open attempt with the same name will fail, and
> * your logic has a loop to recognise such failures and try again
> with a
> new name etc..
> Note GetTempFileName() fails on this front...)
> - Other filename ideas : including timestamps or GUIDs or PIDs in the
> filename, but by
> themselves those may not fully solve uniqueness problem.
> - Listing the directory to generate available filenames might be more
> efficient in some usage cases, especially if the API includes file
> filter options.
>

the issue is that standard windows ways to do it - like chose tool form
menu then use it, save file bny opening save dialogs - are terribly slow
if someone want to do things wuick and fast - thats why i like the
programs like irfanview or total commander for example

here i just want to save current edited image state like by pressing F5
like quicksave in doom game or something and load it by pressing say F8
or something

i would like to save in app directory which probably the application has
right to write...its editor for my use mainly if not exclusively

i want to do a lot of things by keystrokes keyholds and mouse not
by menu etc ..i know such programs are hard to learn and this the
scope of people using them gets down but in turn are quick to do things
if you learn them

hovever i dropped the idea to rapidly code this (becouse other
occupations) but the problem of saving this is somewhat worth to learn

Re: saving fileXXX.bmp

<utrbg2$30267$2@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34749&group=comp.lang.c#34749

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Mon, 25 Mar 2024 09:09:33 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <utrbg2$30267$2@i2pn2.org>
References: <utpl9q$2u0jk$1@i2pn2.org> <utq5qj$2ummn$1@i2pn2.org> <utqcru$l76t$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 25 Mar 2024 08:09:39 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3147975"; 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
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <utqcru$l76t$1@dont-email.me>
 by: fir - Mon, 25 Mar 2024 08:09 UTC

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

Re: saving fileXXX.bmp

<utrbig$30267$3@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34750&group=comp.lang.c#34750

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Mon, 25 Mar 2024 09:10:51 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <utrbig$30267$3@i2pn2.org>
References: <utpl9q$2u0jk$1@i2pn2.org> <utq5qj$2ummn$1@i2pn2.org> <utq6qd$jtaq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 25 Mar 2024 08:10:57 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3147975"; 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
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <utq6qd$jtaq$1@dont-email.me>
 by: fir - Mon, 25 Mar 2024 08:10 UTC

jak wrote:
> fir ha scritto:
>> 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
>
> In order not to manage too many differences between compilers you could
> try this way:
>
> #include <stdio.h>
> #include <limits.h>
>
> int main()
> {
> char pref[50] = "bmp_file_",
> cmd[1024],
> str[PATH_MAX];
> int seq;
> FILE *fp, *f;
>
> sprintf(cmd, "c:\\windows\\system32\\cmd.exe /c dir /b /o:-n %s???
> 2>nul", pref);
>
> if((fp = popen(cmd, "rt")) != NULL)
> {
> if(fgets(str, PATH_MAX, fp) != NULL)
> {
> sscanf(str, "%[^0-9]%3d%*", pref, &seq);
> sprintf(str, "%s%03d", pref, ++seq);
> }
> else
> sprintf(str, "%s%03d", pref, 1);
>
> pclose(fp);
>
> if((f = fopen(str, "r")) == NULL)
> {
> if((f = fopen(str, "w")) == NULL)
> printf("cannot create %s", str);
> }
> else
> printf("%s already exist", str);
>
> if(f != NULL) fclose(f);
> }
> else
> printf("cannot open process");
>
> return 0;
> }
>
> This piece of code is only used to give the idea and is not well tested.

that is almost for sure bad - its liek running separate console program
to add two strings or numbers

Re: saving fileXXX.bmp

<utrcca$303ce$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34751&group=comp.lang.c#34751

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Mon, 25 Mar 2024 09:24:38 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <utrcca$303ce$1@i2pn2.org>
References: <utpl9q$2u0jk$1@i2pn2.org> <utq5qj$2ummn$1@i2pn2.org> <utqcru$l76t$1@dont-email.me> <utrbg2$30267$2@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 25 Mar 2024 08:24:43 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3149198"; 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
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <utrbg2$30267$2@i2pn2.org>
 by: fir - Mon, 25 Mar 2024 08:24 UTC

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)

Re: saving fileXXX.bmp

<zYicnXxWRq4OM5z7nZ2dnZfqn_ednZ2d@brightview.co.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34768&group=comp.lang.c#34768

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 25 Mar 2024 17:04:19 +0000
Subject: Re: saving fileXXX.bmp
Newsgroups: comp.lang.c
References: <utpl9q$2u0jk$1@i2pn2.org>
<jKidnZQtQtYXfJ37nZ2dnZfqnPadnZ2d@brightview.co.uk>
<utrbbd$30267$1@i2pn2.org>
From: news.dea...@darjeeling.plus.com (Mike Terry)
Date: Mon, 25 Mar 2024 17:04:22 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.17
MIME-Version: 1.0
In-Reply-To: <utrbbd$30267$1@i2pn2.org>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 8bit
Message-ID: <zYicnXxWRq4OM5z7nZ2dnZfqn_ednZ2d@brightview.co.uk>
Lines: 84
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-Wp73A0epErkSm/ZGOj6ezfH9ykMoGfrDzMIiqIPSOF/APxs9ULACSAB7md9PnqO+m+vroNtUQUgMnSa!t7KkkixhSBq2EP7g4rs1KHKzaf0Gzp8TxXIqAEaAI3j8PbTICsMfTtkXA0GXDuis5o6eJwTP8V7S!ary86LiPGqY/kxGcgbz3Q2zM866E
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Received-Bytes: 5275
 by: Mike Terry - Mon, 25 Mar 2024 17:04 UTC

On 25/03/2024 08:07, fir wrote:
> Mike Terry wrote:
>> 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)
>>
>> I think the bigger issue is where to create such files?  If users have
>> used your app to open some existing .bmp file for processing, it's quite
>> possible they won't have write access to that folder. In that case a
>> Save or Save As operation should trigger a standard file system file
>> select dialog in a GUI program which is fair enough, but it sounds like
>> you want to create a temp file with no user intervention?  Command line
>> utilities often have some kind of "temp folder" option.
>>
>> Ideas to consider:
>> -  tmpfile()  (POSIX?]
>> -  GetTempFileName(), GetTempPath() [Windows]
>> -  Use environment variables like TMP/TEMP?  (Possibly different usage
>> on different platforms)
>> -  how to clean up such temp files so they don't pollute the file system
>> long term?
>> -  ensuring uniqueness?  [e.g. if multiple copies of your program are
>> running at the same time]
>>     (Your idea is ok on this front, provided:
>>     *  only one process can create the temp file and
>>     *  a second open attempt with the same name will fail, and
>>     *  your logic has a loop to recognise such failures and try again
>> with a
>>        new name etc..
>>     Note GetTempFileName() fails on this front...)
>> -  Other filename ideas : including timestamps or GUIDs or PIDs in the
>> filename, but by
>>     themselves those may not fully solve uniqueness problem.
>> -  Listing the directory to generate available filenames might be more
>>     efficient in some usage cases, especially if the API includes file
>> filter options.
>>
>
> the issue is that standard windows ways to do it - like chose tool form menu then use it, save file
> bny opening save dialogs - are terribly slow if someone want to do things wuick and fast - thats why
> i like the
> programs like irfanview or total commander for example

What you're describing is the standard windows way /for the user to identify a file/ e.g. an
application document that the user has created and wants to save /somewhere they specify/.

It's not the the standard windows way to create a temporary file for application use. For that
purpose I imagine the "standard" process would be to call GetTempPath() then possibly create a
subfolder for your application, and save the file there. "Standard" apps like Visual Studio, Office
etc. all create temp files without prompting the user with a dialog box.

Mike.

>
> here i just want to save current edited image state like by pressing F5
> like quicksave in doom game or something and load it by pressing say F8
> or something
>
> i would like to save in app directory which probably the application has right to write...its editor
> for my use mainly if not exclusively
>
> i want to do a lot of things by keystrokes keyholds and mouse not
> by menu etc ..i know such programs are hard to learn and this the
> scope of people using them gets down but in turn are quick to do things if you learn them
>
> hovever i dropped the idea to rapidly code this (becouse other occupations) but the problem of
> saving this is somewhat worth to learn
>
>
>

Re: saving fileXXX.bmp

<utsfnb$18bvo$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34773&group=comp.lang.c#34773

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nos...@please.ty (jak)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Mon, 25 Mar 2024 19:27:55 +0100
Organization: A noiseless patient Spider
Lines: 150
Message-ID: <utsfnb$18bvo$1@dont-email.me>
References: <utpl9q$2u0jk$1@i2pn2.org> <utq5qj$2ummn$1@i2pn2.org>
<utq6qd$jtaq$1@dont-email.me> <utrbig$30267$3@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 25 Mar 2024 19:27:55 +0100 (CET)
Injection-Info: dont-email.me; posting-host="7a9fb3bf9e6991767d4f471e7a5c838f";
logging-data="1323000"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19c0SP+gmhhEM7in/7PepIa"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:7ioniMy3wV7G6bju8wLR0zvILnA=
In-Reply-To: <utrbig$30267$3@i2pn2.org>
 by: jak - Mon, 25 Mar 2024 18:27 UTC

fir ha scritto:
> jak wrote:
>> fir ha scritto:
>>> 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
>>
>> In order not to manage too many differences between compilers you could
>> try this way:
>>
>> #include <stdio.h>
>> #include <limits.h>
>>
>> int main()
>> {
>>      char pref[50] = "bmp_file_",
>>           cmd[1024],
>>           str[PATH_MAX];
>>      int  seq;
>>      FILE *fp, *f;
>>
>>      sprintf(cmd, "c:\\windows\\system32\\cmd.exe /c dir /b /o:-n %s???
>> 2>nul", pref);
>>
>>      if((fp = popen(cmd, "rt")) != NULL)
>>      {
>>          if(fgets(str, PATH_MAX, fp) != NULL)
>>          {
>>              sscanf(str, "%[^0-9]%3d%*", pref, &seq);
>>              sprintf(str, "%s%03d", pref, ++seq);
>>          }
>>          else
>>              sprintf(str, "%s%03d", pref, 1);
>>
>>          pclose(fp);
>>
>>          if((f = fopen(str, "r")) == NULL)
>>          {
>>              if((f = fopen(str, "w")) == NULL)
>>                  printf("cannot create %s", str);
>>          }
>>          else
>>              printf("%s already exist", str);
>>
>>          if(f != NULL) fclose(f);
>>      }
>>      else
>>          printf("cannot open process");
>>
>>      return 0;
>> }
>>
>> This piece of code is only used to give the idea and is not well tested.
>
>
> that is almost for sure bad - its liek running separate console program
> to add two strings or numbers
>

I knew you would have given a similar answer but if you agree to open
thousands of files to find the last of them, then you could accept that
solution. It does not only do what you say because the system call is
looking for the file for patterns and reverses the order of the list.
All things you should do in your program. In any case, on Windows
systems there are FindFirst/FindNext functions for this type of
operations. Below is an example where I replace the system call with a
function that uses the functions given before. The convenience of the
system call is that on systems *nix works by simply replacing the call
with "/usr/bin/ls -1r .......".

#include <stdio.h>
#include <limits.h>
#include <stdbool.h>
#include <windows.h>

bool FindLastOf(char [], char *);

int main()
{ char pref[] = "bmp_file_",
f2find[50],
str[PATH_MAX];
int seq;
FILE *f;

sprintf(f2find, "%s????", pref);
if(FindLastOf(f2find, str))
{
sscanf(str, "%[^0-9]%4d%*", pref, &seq);
sprintf(str, "%s%04d", pref, ++seq);
}
else
sprintf(str, "%s%04d", pref, 1);

if((f = fopen(str, "r")) == NULL)
{
if((f = fopen(str, "w")) == NULL)
printf("cannot create %s", str);
}
else
printf("%s already exist", str);

if(f != NULL) fclose(f);

return 0;
}

bool FindLastOf(char what[], char *result)
{ WIN32_FIND_DATA fdF;
HANDLE hF= NULL;
bool ret = false;

*result = '\0';
if((hF = FindFirstFile(what, &fdF)) != INVALID_HANDLE_VALUE)
{
do
if(strcmp(fdF.cFileName, result) > 0)
strcpy(result, fdF.cFileName);
while(FindNextFile(hF, &fdF));
ret = true;
FindClose(hF);
}
return ret;
}

Not even this piece of code is well tested and is just an example.

Unfortunately, on the systems where the opendir/readir functions are
available instead of FindFirst/FindFext, the work will be more difficult
because they do not have the receipt for patterns.

Re: saving fileXXX.bmp

<utsfoj$18c5n$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34774&group=comp.lang.c#34774

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mikko.le...@iki.fi (Mikko)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Mon, 25 Mar 2024 20:28:35 +0200
Organization: -
Lines: 19
Message-ID: <utsfoj$18c5n$1@dont-email.me>
References: <utpl9q$2u0jk$1@i2pn2.org> <utpo73$g827$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 25 Mar 2024 19:28:35 +0100 (CET)
Injection-Info: dont-email.me; posting-host="01a3eaf04bb4c908e74f811aecacd172";
logging-data="1323191"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19iYNBZ0+mK9TI/9QuTMA6M"
User-Agent: Unison/2.2
Cancel-Lock: sha1:JTMGUlOlr4tXMc8zrrFT3nY+vhM=
 by: Mikko - Mon, 25 Mar 2024 18:28 UTC

On 2024-03-24 17:34:25 +0000, Malcolm McLean said:

> 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

Different operationg systems and file systems have different rules
about valid file names. For example, "painting001.bmp" might be
too long or the character '.' might be invalid. You could check
whether the creation of the file fails and if it does try another
name.

--
Mikko

Re: saving fileXXX.bmp

<utsgmp$31pg0$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34775&group=comp.lang.c#34775

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Mon, 25 Mar 2024 19:44:34 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <utsgmp$31pg0$1@i2pn2.org>
References: <utpl9q$2u0jk$1@i2pn2.org> <jKidnZQtQtYXfJ37nZ2dnZfqnPadnZ2d@brightview.co.uk> <utrbbd$30267$1@i2pn2.org> <zYicnXxWRq4OM5z7nZ2dnZfqn_ednZ2d@brightview.co.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 25 Mar 2024 18:44:41 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3204608"; 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: <zYicnXxWRq4OM5z7nZ2dnZfqn_ednZ2d@brightview.co.uk>
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: fir - Mon, 25 Mar 2024 18:44 UTC

Mike Terry wrote:
> On 25/03/2024 08:07, fir wrote:
>> Mike Terry wrote:
>>> 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)
>>>
>>> I think the bigger issue is where to create such files? If users have
>>> used your app to open some existing .bmp file for processing, it's quite
>>> possible they won't have write access to that folder. In that case a
>>> Save or Save As operation should trigger a standard file system file
>>> select dialog in a GUI program which is fair enough, but it sounds like
>>> you want to create a temp file with no user intervention? Command line
>>> utilities often have some kind of "temp folder" option.
>>>
>>> Ideas to consider:
>>> - tmpfile() (POSIX?]
>>> - GetTempFileName(), GetTempPath() [Windows]
>>> - Use environment variables like TMP/TEMP? (Possibly different usage
>>> on different platforms)
>>> - how to clean up such temp files so they don't pollute the file system
>>> long term?
>>> - ensuring uniqueness? [e.g. if multiple copies of your program are
>>> running at the same time]
>>> (Your idea is ok on this front, provided:
>>> * only one process can create the temp file and
>>> * a second open attempt with the same name will fail, and
>>> * your logic has a loop to recognise such failures and try again
>>> with a
>>> new name etc..
>>> Note GetTempFileName() fails on this front...)
>>> - Other filename ideas : including timestamps or GUIDs or PIDs in the
>>> filename, but by
>>> themselves those may not fully solve uniqueness problem.
>>> - Listing the directory to generate available filenames might be more
>>> efficient in some usage cases, especially if the API includes file
>>> filter options.
>>>
>>
>> the issue is that standard windows ways to do it - like chose tool
>> form menu then use it, save file bny opening save dialogs - are
>> terribly slow if someone want to do things wuick and fast - thats why
>> i like the
>> programs like irfanview or total commander for example
>
> What you're describing is the standard windows way /for the user to
> identify a file/ e.g. an application document that the user has created
> and wants to save /somewhere they specify/.
>
> It's not the the standard windows way to create a temporary file for
> application use. For that purpose I imagine the "standard" process
> would be to call GetTempPath() then possibly create a subfolder for your
> application, and save the file there. "Standard" apps like Visual
> Studio, Office etc. all create temp files without prompting the user
> with a dialog box.
>
> Mike.
>

i dont want temp file so i dont fully know what you are talkin about

i just want a quicksave say you draw image and after say 30 seconds of
editions you pred F5 for quicksave and you got a history of editions in
a form of many bitmaps in working directory - then you can delect them
and delete those not needed with total commander

Re: saving fileXXX.bmp

<55lMN.723881$p%Mb.525030@fx15.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34777&group=comp.lang.c#34777

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx15.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: saving fileXXX.bmp
Newsgroups: comp.lang.c
References: <utpl9q$2u0jk$1@i2pn2.org> <utq5qj$2ummn$1@i2pn2.org> <utq6qd$jtaq$1@dont-email.me> <utrbig$30267$3@i2pn2.org> <utsfnb$18bvo$1@dont-email.me>
Lines: 153
Message-ID: <55lMN.723881$p%Mb.525030@fx15.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 25 Mar 2024 20:25:37 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 25 Mar 2024 20:25:37 GMT
X-Received-Bytes: 5736
 by: Scott Lurndal - Mon, 25 Mar 2024 20:25 UTC

jak <nospam@please.ty> writes:
>fir ha scritto:
>> jak wrote:
>>> fir ha scritto:
>>>> 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
>>>
>>> In order not to manage too many differences between compilers you could
>>> try this way:
>>>
>>> #include <stdio.h>
>>> #include <limits.h>
>>>
>>> int main()
>>> {
>>>      char pref[50] = "bmp_file_",
>>>           cmd[1024],
>>>           str[PATH_MAX];
>>>      int  seq;
>>>      FILE *fp, *f;
>>>
>>>      sprintf(cmd, "c:\\windows\\system32\\cmd.exe /c dir /b /o:-n %s???
>>> 2>nul", pref);
>>>
>>>      if((fp = popen(cmd, "rt")) != NULL)
>>>      {
>>>          if(fgets(str, PATH_MAX, fp) != NULL)
>>>          {
>>>              sscanf(str, "%[^0-9]%3d%*", pref, &seq);
>>>              sprintf(str, "%s%03d", pref, ++seq);
>>>          }
>>>          else
>>>              sprintf(str, "%s%03d", pref, 1);
>>>
>>>          pclose(fp);
>>>
>>>          if((f = fopen(str, "r")) == NULL)
>>>          {
>>>              if((f = fopen(str, "w")) == NULL)
>>>                  printf("cannot create %s", str);
>>>          }
>>>          else
>>>              printf("%s already exist", str);
>>>
>>>          if(f != NULL) fclose(f);
>>>      }
>>>      else
>>>          printf("cannot open process");
>>>
>>>      return 0;
>>> }
>>>
>>> This piece of code is only used to give the idea and is not well tested.
>>
>>
>> that is almost for sure bad - its liek running separate console program
>> to add two strings or numbers
>>
>
>I knew you would have given a similar answer but if you agree to open
>thousands of files to find the last of them, then you could accept that
>solution. It does not only do what you say because the system call is
>looking for the file for patterns and reverses the order of the list.
>All things you should do in your program. In any case, on Windows
>systems there are FindFirst/FindNext functions for this type of
>operations. Below is an example where I replace the system call with a
>function that uses the functions given before. The convenience of the
>system call is that on systems *nix works by simply replacing the call
>with "/usr/bin/ls -1r .......".
>
>#include <stdio.h>
>#include <limits.h>
>#include <stdbool.h>
>#include <windows.h>
>
>bool FindLastOf(char [], char *);
>
>int main()
>{
> char pref[] = "bmp_file_",
> f2find[50],
> str[PATH_MAX];
> int seq;
> FILE *f;
>
> sprintf(f2find, "%s????", pref);
> if(FindLastOf(f2find, str))
> {
> sscanf(str, "%[^0-9]%4d%*", pref, &seq);
> sprintf(str, "%s%04d", pref, ++seq);
> }
> else
> sprintf(str, "%s%04d", pref, 1);
>
> if((f = fopen(str, "r")) == NULL)
> {
> if((f = fopen(str, "w")) == NULL)
> printf("cannot create %s", str);
> }
> else
> printf("%s already exist", str);
>
> if(f != NULL) fclose(f);
>
> return 0;
>}
>
>bool FindLastOf(char what[], char *result)
>{
> WIN32_FIND_DATA fdF;
> HANDLE hF= NULL;
> bool ret = false;
>
> *result = '\0';
> if((hF = FindFirstFile(what, &fdF)) != INVALID_HANDLE_VALUE)
> {
> do
> if(strcmp(fdF.cFileName, result) > 0)
> strcpy(result, fdF.cFileName);
> while(FindNextFile(hF, &fdF));
> ret = true;
> FindClose(hF);
> }
> return ret;
>}
>
>Not even this piece of code is well tested and is just an example.
>
>Unfortunately, on the systems where the opendir/readir functions are
>available instead of FindFirst/FindFext, the work will be more difficult
>because they do not have the receipt for patterns.
>

Fortunately, those systems have wordexp(3) and fnmatch(3).

Re: saving fileXXX.bmp

<VdecnfVN_aK1bpz7nZ2dnZfqnPidnZ2d@brightview.co.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34781&group=comp.lang.c#34781

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!news.swapon.de!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 25 Mar 2024 21:56:56 +0000
Subject: Re: saving fileXXX.bmp
Newsgroups: comp.lang.c
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>
From: news.dea...@darjeeling.plus.com (Mike Terry)
Date: Mon, 25 Mar 2024 21:56:59 +0000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.17
MIME-Version: 1.0
In-Reply-To: <utsgmp$31pg0$1@i2pn2.org>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 8bit
Message-ID: <VdecnfVN_aK1bpz7nZ2dnZfqnPidnZ2d@brightview.co.uk>
Lines: 85
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-ff2lBFPfPfhz9+4xyk6enHKD1reayGlXdccdMleEgnOApYIBNCGrYFH2tzdtJYq+SPi46yqreliuxaX!VavUTafbYtNDctu93qCjcYLLILUg6y8Xe2XTpOgxduumapLhAgIUUbt1CbJxMtrms9IzVFBkYuG9!9xp0vv9mYgVUIFR+YREvCHzRoDOT
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Received-Bytes: 5498
 by: Mike Terry - Mon, 25 Mar 2024 21:56 UTC

On 25/03/2024 18:44, fir wrote:
> Mike Terry wrote:
>> On 25/03/2024 08:07, fir wrote:
>>> Mike Terry wrote:
>>>> 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)
>>>>
>>>> I think the bigger issue is where to create such files?  If users have
>>>> used your app to open some existing .bmp file for processing, it's quite
>>>> possible they won't have write access to that folder. In that case a
>>>> Save or Save As operation should trigger a standard file system file
>>>> select dialog in a GUI program which is fair enough, but it sounds like
>>>> you want to create a temp file with no user intervention?  Command line
>>>> utilities often have some kind of "temp folder" option.
>>>>
>>>> Ideas to consider:
>>>> -  tmpfile()  (POSIX?]
>>>> -  GetTempFileName(), GetTempPath() [Windows]
>>>> -  Use environment variables like TMP/TEMP?  (Possibly different usage
>>>> on different platforms)
>>>> -  how to clean up such temp files so they don't pollute the file system
>>>> long term?
>>>> -  ensuring uniqueness?  [e.g. if multiple copies of your program are
>>>> running at the same time]
>>>>     (Your idea is ok on this front, provided:
>>>>     *  only one process can create the temp file and
>>>>     *  a second open attempt with the same name will fail, and
>>>>     *  your logic has a loop to recognise such failures and try again
>>>> with a
>>>>        new name etc..
>>>>     Note GetTempFileName() fails on this front...)
>>>> -  Other filename ideas : including timestamps or GUIDs or PIDs in the
>>>> filename, but by
>>>>     themselves those may not fully solve uniqueness problem.
>>>> -  Listing the directory to generate available filenames might be more
>>>>     efficient in some usage cases, especially if the API includes file
>>>> filter options.
>>>>
>>>
>>> the issue is that standard windows ways to do it - like chose tool
>>> form menu then use it, save file bny opening save dialogs - are
>>> terribly slow if someone want to do things wuick and fast - thats why
>>> i like the
>>> programs like irfanview or total commander for example
>>
>> What you're describing is the standard windows way /for the user to
>> identify a file/ e.g. an application document that the user has created
>> and wants to save /somewhere they specify/.
>>
>> It's not the the standard windows way to create a temporary file for
>> application use.  For that purpose I imagine the "standard" process
>> would be to call GetTempPath() then possibly create a subfolder for your
>> application, and save the file there.  "Standard" apps like Visual
>> Studio, Office etc. all create temp files without prompting the user
>> with a dialog box.
>>
>> Mike.
>>
>
> i dont want temp file so i dont fully know what you are talkin about
>
> i just want a quicksave say you draw image and after say 30 seconds of editions you pred F5 for
> quicksave and you got a history of editions in a form of many bitmaps in working directory - then
> you can delect them and delete those not needed with total commander
>

Sure... if you know where you want to save the quicksaves and you're confident the user will have
access to that location, no problem. [My earlier idea of putting the date/time in the filename
might still be useful, e.g. when you come to delete the files later on with TC.]

Mike.

Re: saving fileXXX.bmp

<utu2lg$33hth$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34784&group=comp.lang.c#34784

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Tue, 26 Mar 2024 09:57:24 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <utu2lg$33hth$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>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 26 Mar 2024 08:57:21 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3262385"; 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: <VdecnfVN_aK1bpz7nZ2dnZfqnPidnZ2d@brightview.co.uk>
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: fir - Tue, 26 Mar 2024 08:57 UTC

Mike Terry wrote:
> On 25/03/2024 18:44, fir wrote:
>> Mike Terry wrote:
>>> On 25/03/2024 08:07, fir wrote:
>>>> Mike Terry wrote:
>>>>> 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)
>>>>>
>>>>> I think the bigger issue is where to create such files? If users have
>>>>> used your app to open some existing .bmp file for processing, it's
>>>>> quite
>>>>> possible they won't have write access to that folder. In that case a
>>>>> Save or Save As operation should trigger a standard file system file
>>>>> select dialog in a GUI program which is fair enough, but it sounds
>>>>> like
>>>>> you want to create a temp file with no user intervention? Command
>>>>> line
>>>>> utilities often have some kind of "temp folder" option.
>>>>>
>>>>> Ideas to consider:
>>>>> - tmpfile() (POSIX?]
>>>>> - GetTempFileName(), GetTempPath() [Windows]
>>>>> - Use environment variables like TMP/TEMP? (Possibly different usage
>>>>> on different platforms)
>>>>> - how to clean up such temp files so they don't pollute the file
>>>>> system
>>>>> long term?
>>>>> - ensuring uniqueness? [e.g. if multiple copies of your program are
>>>>> running at the same time]
>>>>> (Your idea is ok on this front, provided:
>>>>> * only one process can create the temp file and
>>>>> * a second open attempt with the same name will fail, and
>>>>> * your logic has a loop to recognise such failures and try again
>>>>> with a
>>>>> new name etc..
>>>>> Note GetTempFileName() fails on this front...)
>>>>> - Other filename ideas : including timestamps or GUIDs or PIDs in the
>>>>> filename, but by
>>>>> themselves those may not fully solve uniqueness problem.
>>>>> - Listing the directory to generate available filenames might be more
>>>>> efficient in some usage cases, especially if the API includes file
>>>>> filter options.
>>>>>
>>>>
>>>> the issue is that standard windows ways to do it - like chose tool
>>>> form menu then use it, save file bny opening save dialogs - are
>>>> terribly slow if someone want to do things wuick and fast - thats why
>>>> i like the
>>>> programs like irfanview or total commander for example
>>>
>>> What you're describing is the standard windows way /for the user to
>>> identify a file/ e.g. an application document that the user has created
>>> and wants to save /somewhere they specify/.
>>>
>>> It's not the the standard windows way to create a temporary file for
>>> application use. For that purpose I imagine the "standard" process
>>> would be to call GetTempPath() then possibly create a subfolder for your
>>> application, and save the file there. "Standard" apps like Visual
>>> Studio, Office etc. all create temp files without prompting the user
>>> with a dialog box.
>>>
>>> Mike.
>>>
>>
>> i dont want temp file so i dont fully know what you are talkin about
>>
>> i just want a quicksave say you draw image and after say 30 seconds of
>> editions you pred F5 for quicksave and you got a history of editions
>> in a form of many bitmaps in working directory - then you can delect
>> them and delete those not needed with total commander
>>
>
> Sure... if you know where you want to save the quicksaves and you're
> confident the user will have access to that location, no problem. [My
> earlier idea of putting the date/time in the filename might still be
> useful, e.g. when you come to delete the files later on with TC.]
>

i though on this date too, it is easier than generating number but as i
would also want to read those files (say like holding controll and using
arrows left/right) the date is then slightly worse

- though not so much as to be fullly proper i couldnt assume all
the previous piant+ numbers are present so probably full right
way to do it is to read directory files in the list sort and take the
last ... its kinda a dose of work though fortunateli i got code for such
things in my library (sickle.c)

Re: saving fileXXX.bmp

<utu3qg$33j67$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34785&group=comp.lang.c#34785

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Tue, 26 Mar 2024 10:17:12 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <utu3qg$33j67$1@i2pn2.org>
References: <utpl9q$2u0jk$1@i2pn2.org> <utq5qj$2ummn$1@i2pn2.org> <utq6qd$jtaq$1@dont-email.me> <utrbig$30267$3@i2pn2.org> <utsfnb$18bvo$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 26 Mar 2024 09:17:06 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3263687"; 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: <utsfnb$18bvo$1@dont-email.me>
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: fir - Tue, 26 Mar 2024 09:17 UTC

jak wrote:
> fir ha scritto:
>> jak wrote:
>>> fir ha scritto:
>>>> 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
>>>
>>> In order not to manage too many differences between compilers you could
>>> try this way:
>>>
>>> #include <stdio.h>
>>> #include <limits.h>
>>>
>>> int main()
>>> {
>>> char pref[50] = "bmp_file_",
>>> cmd[1024],
>>> str[PATH_MAX];
>>> int seq;
>>> FILE *fp, *f;
>>>
>>> sprintf(cmd, "c:\\windows\\system32\\cmd.exe /c dir /b /o:-n %s???
>>> 2>nul", pref);
>>>
>>> if((fp = popen(cmd, "rt")) != NULL)
>>> {
>>> if(fgets(str, PATH_MAX, fp) != NULL)
>>> {
>>> sscanf(str, "%[^0-9]%3d%*", pref, &seq);
>>> sprintf(str, "%s%03d", pref, ++seq);
>>> }
>>> else
>>> sprintf(str, "%s%03d", pref, 1);
>>>
>>> pclose(fp);
>>>
>>> if((f = fopen(str, "r")) == NULL)
>>> {
>>> if((f = fopen(str, "w")) == NULL)
>>> printf("cannot create %s", str);
>>> }
>>> else
>>> printf("%s already exist", str);
>>>
>>> if(f != NULL) fclose(f);
>>> }
>>> else
>>> printf("cannot open process");
>>>
>>> return 0;
>>> }
>>>
>>> This piece of code is only used to give the idea and is not well tested.
>>
>>
>> that is almost for sure bad - its liek running separate console program
>> to add two strings or numbers
>>
>
> I knew you would have given a similar answer but if you agree to open
> thousands of files to find the last of them, then you could accept that
> solution. It does not only do what you say because the system call is
> looking for the file for patterns and reverses the order of the list.
> All things you should do in your program. In any case, on Windows
> systems there are FindFirst/FindNext functions for this type of
> operations. Below is an example where I replace the system call with a
> function that uses the functions given before. The convenience of the
> system call is that on systems *nix works by simply replacing the call
> with "/usr/bin/ls -1r .......".
>
> #include <stdio.h>
> #include <limits.h>
> #include <stdbool.h>
> #include <windows.h>
>
> bool FindLastOf(char [], char *);
>
> int main()
> {
> char pref[] = "bmp_file_",
> f2find[50],
> str[PATH_MAX];
> int seq;
> FILE *f;
>
> sprintf(f2find, "%s????", pref);
> if(FindLastOf(f2find, str))
> {
> sscanf(str, "%[^0-9]%4d%*", pref, &seq);
> sprintf(str, "%s%04d", pref, ++seq);
> }
> else
> sprintf(str, "%s%04d", pref, 1);
>
> if((f = fopen(str, "r")) == NULL)
> {
> if((f = fopen(str, "w")) == NULL)
> printf("cannot create %s", str);
> }
> else
> printf("%s already exist", str);
>
> if(f != NULL) fclose(f);
>
> return 0;
> }
>
> bool FindLastOf(char what[], char *result)
> {
> WIN32_FIND_DATA fdF;
> HANDLE hF= NULL;
> bool ret = false;
>
> *result = '\0';
> if((hF = FindFirstFile(what, &fdF)) != INVALID_HANDLE_VALUE)
> {
> do
> if(strcmp(fdF.cFileName, result) > 0)
> strcpy(result, fdF.cFileName);
> while(FindNextFile(hF, &fdF));
> ret = true;
> FindClose(hF);
> }
> return ret;
> }
>
> Not even this piece of code is well tested and is just an example.
>
> Unfortunately, on the systems where the opendir/readir functions are
> available instead of FindFirst/FindFext, the work will be more difficult
> because they do not have the receipt for patterns.
>

im not sure what you do your style is unclear to me esp i found name
FindLastOf possibly misleading - what last of it founds?

wait a bit maybe i will wrote you how i would od it i got my library
sickle.c which is able to read list of those names to container in ram
and then operate on this

Re: saving fileXXX.bmp

<utu6ra$33mvr$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34786&group=comp.lang.c#34786

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Tue, 26 Mar 2024 11:08:49 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <utu6ra$33mvr$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>
MIME-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 26 Mar 2024 10:08:42 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3267579"; 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
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <utu2lg$33hth$1@i2pn2.org>
 by: fir - Tue, 26 Mar 2024 10:08 UTC

fir wrote:
> Mike Terry wrote:
>> On 25/03/2024 18:44, fir wrote:
>>> Mike Terry wrote:
>>>> On 25/03/2024 08:07, fir wrote:
>>>>> Mike Terry wrote:
>>>>>> 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)
>>>>>>
>>>>>> I think the bigger issue is where to create such files? If users
>>>>>> have
>>>>>> used your app to open some existing .bmp file for processing, it's
>>>>>> quite
>>>>>> possible they won't have write access to that folder. In that case a
>>>>>> Save or Save As operation should trigger a standard file system file
>>>>>> select dialog in a GUI program which is fair enough, but it sounds
>>>>>> like
>>>>>> you want to create a temp file with no user intervention? Command
>>>>>> line
>>>>>> utilities often have some kind of "temp folder" option.
>>>>>>
>>>>>> Ideas to consider:
>>>>>> - tmpfile() (POSIX?]
>>>>>> - GetTempFileName(), GetTempPath() [Windows]
>>>>>> - Use environment variables like TMP/TEMP? (Possibly different
>>>>>> usage
>>>>>> on different platforms)
>>>>>> - how to clean up such temp files so they don't pollute the file
>>>>>> system
>>>>>> long term?
>>>>>> - ensuring uniqueness? [e.g. if multiple copies of your program are
>>>>>> running at the same time]
>>>>>> (Your idea is ok on this front, provided:
>>>>>> * only one process can create the temp file and
>>>>>> * a second open attempt with the same name will fail, and
>>>>>> * your logic has a loop to recognise such failures and try again
>>>>>> with a
>>>>>> new name etc..
>>>>>> Note GetTempFileName() fails on this front...)
>>>>>> - Other filename ideas : including timestamps or GUIDs or PIDs in
>>>>>> the
>>>>>> filename, but by
>>>>>> themselves those may not fully solve uniqueness problem.
>>>>>> - Listing the directory to generate available filenames might be
>>>>>> more
>>>>>> efficient in some usage cases, especially if the API includes
>>>>>> file
>>>>>> filter options.
>>>>>>
>>>>>
>>>>> the issue is that standard windows ways to do it - like chose tool
>>>>> form menu then use it, save file bny opening save dialogs - are
>>>>> terribly slow if someone want to do things wuick and fast - thats why
>>>>> i like the
>>>>> programs like irfanview or total commander for example
>>>>
>>>> What you're describing is the standard windows way /for the user to
>>>> identify a file/ e.g. an application document that the user has created
>>>> and wants to save /somewhere they specify/.
>>>>
>>>> It's not the the standard windows way to create a temporary file for
>>>> application use. For that purpose I imagine the "standard" process
>>>> would be to call GetTempPath() then possibly create a subfolder for
>>>> your
>>>> application, and save the file there. "Standard" apps like Visual
>>>> Studio, Office etc. all create temp files without prompting the user
>>>> with a dialog box.
>>>>
>>>> Mike.
>>>>
>>>
>>> i dont want temp file so i dont fully know what you are talkin about
>>>
>>> i just want a quicksave say you draw image and after say 30 seconds of
>>> editions you pred F5 for quicksave and you got a history of editions
>>> in a form of many bitmaps in working directory - then you can delect
>>> them and delete those not needed with total commander
>>>
>>
>> Sure... if you know where you want to save the quicksaves and you're
>> confident the user will have access to that location, no problem. [My
>> earlier idea of putting the date/time in the filename might still be
>> useful, e.g. when you come to delete the files later on with TC.]
>>
>
> i though on this date too, it is easier than generating number but as i
> would also want to read those files (say like holding controll and using
> arrows left/right) the date is then slightly worse
>
> - though not so much as to be fullly proper i couldnt assume all
> the previous piant+ numbers are present so probably full right
> way to do it is to read directory files in the list sort and take the
> last ... its kinda a dose of work though fortunateli i got code for such
> things in my library (sickle.c)
>
>
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 ;
}

//tests

void TestFileNameList()
{
FileNameList_AddOne("ala.bmp");
FileNameList_AddOne("ma.bmp");
FileNameList_AddOne("kota.bmp");

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

}

Re: saving fileXXX.bmp

<utu9q9$33qfv$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34787&group=comp.lang.c#34787

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
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
 by: fir - Tue, 26 Mar 2024 10:59 UTC

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

Re: saving fileXXX.bmp

<utu9v8$33qfv$2@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34788&group=comp.lang.c#34788

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Tue, 26 Mar 2024 12:02:09 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <utu9v8$33qfv$2@i2pn2.org>
References: <utpl9q$2u0jk$1@i2pn2.org> <utq5qj$2ummn$1@i2pn2.org> <utq6qd$jtaq$1@dont-email.me> <utrbig$30267$3@i2pn2.org> <utsfnb$18bvo$1@dont-email.me> <utu3qg$33j67$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 26 Mar 2024 11:02:01 -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
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <utu3qg$33j67$1@i2pn2.org>
 by: fir - Tue, 26 Mar 2024 11:02 UTC

fir wrote:
> jak wrote:
>> fir ha scritto:
>>> jak wrote:
>>>> fir ha scritto:
>>>>> 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
>>>>
>>>> In order not to manage too many differences between compilers you could
>>>> try this way:
>>>>
>>>> #include <stdio.h>
>>>> #include <limits.h>
>>>>
>>>> int main()
>>>> {
>>>> char pref[50] = "bmp_file_",
>>>> cmd[1024],
>>>> str[PATH_MAX];
>>>> int seq;
>>>> FILE *fp, *f;
>>>>
>>>> sprintf(cmd, "c:\\windows\\system32\\cmd.exe /c dir /b /o:-n %s???
>>>> 2>nul", pref);
>>>>
>>>> if((fp = popen(cmd, "rt")) != NULL)
>>>> {
>>>> if(fgets(str, PATH_MAX, fp) != NULL)
>>>> {
>>>> sscanf(str, "%[^0-9]%3d%*", pref, &seq);
>>>> sprintf(str, "%s%03d", pref, ++seq);
>>>> }
>>>> else
>>>> sprintf(str, "%s%03d", pref, 1);
>>>>
>>>> pclose(fp);
>>>>
>>>> if((f = fopen(str, "r")) == NULL)
>>>> {
>>>> if((f = fopen(str, "w")) == NULL)
>>>> printf("cannot create %s", str);
>>>> }
>>>> else
>>>> printf("%s already exist", str);
>>>>
>>>> if(f != NULL) fclose(f);
>>>> }
>>>> else
>>>> printf("cannot open process");
>>>>
>>>> return 0;
>>>> }
>>>>
>>>> This piece of code is only used to give the idea and is not well
>>>> tested.
>>>
>>>
>>> that is almost for sure bad - its liek running separate console program
>>> to add two strings or numbers
>>>
>>
>> I knew you would have given a similar answer but if you agree to open
>> thousands of files to find the last of them, then you could accept that
>> solution. It does not only do what you say because the system call is
>> looking for the file for patterns and reverses the order of the list.
>> All things you should do in your program. In any case, on Windows
>> systems there are FindFirst/FindNext functions for this type of
>> operations. Below is an example where I replace the system call with a
>> function that uses the functions given before. The convenience of the
>> system call is that on systems *nix works by simply replacing the call
>> with "/usr/bin/ls -1r .......".
>>
>> #include <stdio.h>
>> #include <limits.h>
>> #include <stdbool.h>
>> #include <windows.h>
>>
>> bool FindLastOf(char [], char *);
>>
>> int main()
>> {
>> char pref[] = "bmp_file_",
>> f2find[50],
>> str[PATH_MAX];
>> int seq;
>> FILE *f;
>>
>> sprintf(f2find, "%s????", pref);
>> if(FindLastOf(f2find, str))
>> {
>> sscanf(str, "%[^0-9]%4d%*", pref, &seq);
>> sprintf(str, "%s%04d", pref, ++seq);
>> }
>> else
>> sprintf(str, "%s%04d", pref, 1);
>>
>> if((f = fopen(str, "r")) == NULL)
>> {
>> if((f = fopen(str, "w")) == NULL)
>> printf("cannot create %s", str);
>> }
>> else
>> printf("%s already exist", str);
>>
>> if(f != NULL) fclose(f);
>>
>> return 0;
>> }
>>
>> bool FindLastOf(char what[], char *result)
>> {
>> WIN32_FIND_DATA fdF;
>> HANDLE hF= NULL;
>> bool ret = false;
>>
>> *result = '\0';
>> if((hF = FindFirstFile(what, &fdF)) != INVALID_HANDLE_VALUE)
>> {
>> do
>> if(strcmp(fdF.cFileName, result) > 0)
>> strcpy(result, fdF.cFileName);
>> while(FindNextFile(hF, &fdF));
>> ret = true;
>> FindClose(hF);
>> }
>> return ret;
>> }
>>
>> Not even this piece of code is well tested and is just an example.
>>
>> Unfortunately, on the systems where the opendir/readir functions are
>> available instead of FindFirst/FindFext, the work will be more difficult
>> because they do not have the receipt for patterns.
>>
>
> im not sure what you do your style is unclear to me esp i found name
> FindLastOf possibly misleading - what last of it founds?
>
>
> wait a bit maybe i will wrote you how i would od it i got my library
> sickle.c which is able to read list of those names to container in ram
> and then operate on this
>

i see i posted it in wrong place so here it should be

> 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

Re: saving fileXXX.bmp

<utv1e1$28rsc$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34791&group=comp.lang.c#34791

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nos...@please.ty (jak)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Tue, 26 Mar 2024 18:42:24 +0100
Organization: A noiseless patient Spider
Lines: 249
Message-ID: <utv1e1$28rsc$1@dont-email.me>
References: <utpl9q$2u0jk$1@i2pn2.org> <utq5qj$2ummn$1@i2pn2.org>
<utq6qd$jtaq$1@dont-email.me> <utrbig$30267$3@i2pn2.org>
<utsfnb$18bvo$1@dont-email.me> <utu3qg$33j67$1@i2pn2.org>
<utu9v8$33qfv$2@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 26 Mar 2024 17:42:25 +0100 (CET)
Injection-Info: dont-email.me; posting-host="12c7675f9c136a1c90617a3403e6be2d";
logging-data="2387852"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1uYbKgeWHKtbvgUzUL/HK"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:rtZpsFqjRrwKlTrEfh7BtaghFNM=
In-Reply-To: <utu9v8$33qfv$2@i2pn2.org>
 by: jak - Tue, 26 Mar 2024 17:42 UTC

fir ha scritto:
> fir wrote:
>> jak wrote:
>>> fir ha scritto:
>>>> jak wrote:
>>>>> fir ha scritto:
>>>>>> 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
>>>>>
>>>>> In order not to manage too many differences between compilers you
>>>>> could
>>>>> try this way:
>>>>>
>>>>> #include <stdio.h>
>>>>> #include <limits.h>
>>>>>
>>>>> int main()
>>>>> {
>>>>>      char pref[50] = "bmp_file_",
>>>>>           cmd[1024],
>>>>>           str[PATH_MAX];
>>>>>      int  seq;
>>>>>      FILE *fp, *f;
>>>>>
>>>>>      sprintf(cmd, "c:\\windows\\system32\\cmd.exe /c dir /b /o:-n
>>>>> %s???
>>>>> 2>nul", pref);
>>>>>
>>>>>      if((fp = popen(cmd, "rt")) != NULL)
>>>>>      {
>>>>>          if(fgets(str, PATH_MAX, fp) != NULL)
>>>>>          {
>>>>>              sscanf(str, "%[^0-9]%3d%*", pref, &seq);
>>>>>              sprintf(str, "%s%03d", pref, ++seq);
>>>>>          }
>>>>>          else
>>>>>              sprintf(str, "%s%03d", pref, 1);
>>>>>
>>>>>          pclose(fp);
>>>>>
>>>>>          if((f = fopen(str, "r")) == NULL)
>>>>>          {
>>>>>              if((f = fopen(str, "w")) == NULL)
>>>>>                  printf("cannot create %s", str);
>>>>>          }
>>>>>          else
>>>>>              printf("%s already exist", str);
>>>>>
>>>>>          if(f != NULL) fclose(f);
>>>>>      }
>>>>>      else
>>>>>          printf("cannot open process");
>>>>>
>>>>>      return 0;
>>>>> }
>>>>>
>>>>> This piece of code is only used to give the idea and is not well
>>>>> tested.
>>>>
>>>>
>>>> that is almost for sure bad - its liek running separate console program
>>>> to add two strings or numbers
>>>>
>>>
>>> I knew you would have given a similar answer but if you agree to open
>>> thousands of files to find the last of them, then you could accept that
>>> solution. It does not only do what you say because the system call is
>>> looking for the file for patterns and reverses the order of the list.
>>> All things you should do in your program. In any case, on Windows
>>> systems there are FindFirst/FindNext functions for this type of
>>> operations. Below is an example where I replace the system call with a
>>> function that uses the functions given before. The convenience of the
>>> system call is that on systems *nix works by simply replacing the call
>>> with "/usr/bin/ls -1r .......".
>>>
>>> #include <stdio.h>
>>> #include <limits.h>
>>> #include <stdbool.h>
>>> #include <windows.h>
>>>
>>> bool FindLastOf(char [], char *);
>>>
>>> int main()
>>> {
>>>      char pref[] = "bmp_file_",
>>>           f2find[50],
>>>           str[PATH_MAX];
>>>      int  seq;
>>>      FILE *f;
>>>
>>>      sprintf(f2find, "%s????", pref);
>>>      if(FindLastOf(f2find, str))
>>>      {
>>>          sscanf(str, "%[^0-9]%4d%*", pref, &seq);
>>>          sprintf(str, "%s%04d", pref, ++seq);
>>>      }
>>>      else
>>>          sprintf(str, "%s%04d", pref, 1);
>>>
>>>      if((f = fopen(str, "r")) == NULL)
>>>      {
>>>          if((f = fopen(str, "w")) == NULL)
>>>              printf("cannot create %s", str);
>>>      }
>>>      else
>>>          printf("%s already exist", str);
>>>
>>>      if(f != NULL) fclose(f);
>>>
>>>      return 0;
>>> }
>>>
>>> bool FindLastOf(char what[], char *result)
>>> {
>>>      WIN32_FIND_DATA fdF;
>>>      HANDLE hF= NULL;
>>>      bool ret = false;
>>>
>>>      *result = '\0';
>>>      if((hF = FindFirstFile(what, &fdF)) != INVALID_HANDLE_VALUE)
>>>      {
>>>          do
>>>              if(strcmp(fdF.cFileName, result) > 0)
>>>                  strcpy(result, fdF.cFileName);
>>>          while(FindNextFile(hF, &fdF));
>>>          ret = true;
>>>          FindClose(hF);
>>>      }
>>>      return ret;
>>> }
>>>
>>> Not even this piece of code is well tested and is just an example.
>>>
>>> Unfortunately, on the systems where the opendir/readir functions are
>>> available instead of FindFirst/FindFext, the work will be more difficult
>>> because they do not have the receipt for patterns.
>>>
>>
>> im not sure what you do your style is unclear to me esp i found name
>> FindLastOf possibly misleading - what last of it founds?
>>
>>
>> wait a bit maybe i will wrote you how i would od it i got my library
>> sickle.c which is able to read list of those names to container in ram
>> and then operate on this
>>
>
>
> i see i posted it in wrong place so here it should be
>
> > 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


Click here to read the complete article
Re: saving fileXXX.bmp

<uu0qnk$3714j$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34792&group=comp.lang.c#34792

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Wed, 27 Mar 2024 11:00:19 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <uu0qnk$3714j$1@i2pn2.org>
References: <utpl9q$2u0jk$1@i2pn2.org> <utq5qj$2ummn$1@i2pn2.org> <utq6qd$jtaq$1@dont-email.me> <utrbig$30267$3@i2pn2.org> <utsfnb$18bvo$1@dont-email.me> <utu3qg$33j67$1@i2pn2.org> <utu9v8$33qfv$2@i2pn2.org> <utv1e1$28rsc$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 27 Mar 2024 10:00:21 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3376275"; 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
X-Spam-Checker-Version: SpamAssassin 4.0.0
In-Reply-To: <utv1e1$28rsc$1@dont-email.me>
 by: fir - Wed, 27 Mar 2024 10:00 UTC

jak wrote:
> fir ha scritto:
>> fir wrote:
>>> jak wrote:
>>>> fir ha scritto:
>>>>> jak wrote:
>>>>>> fir ha scritto:
>>>>>>> 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
>>>>>>
>>>>>> In order not to manage too many differences between compilers you
>>>>>> could
>>>>>> try this way:
>>>>>>
>>>>>> #include <stdio.h>
>>>>>> #include <limits.h>
>>>>>>
>>>>>> int main()
>>>>>> {
>>>>>> char pref[50] = "bmp_file_",
>>>>>> cmd[1024],
>>>>>> str[PATH_MAX];
>>>>>> int seq;
>>>>>> FILE *fp, *f;
>>>>>>
>>>>>> sprintf(cmd, "c:\\windows\\system32\\cmd.exe /c dir /b /o:-n
>>>>>> %s???
>>>>>> 2>nul", pref);
>>>>>>
>>>>>> if((fp = popen(cmd, "rt")) != NULL)
>>>>>> {
>>>>>> if(fgets(str, PATH_MAX, fp) != NULL)
>>>>>> {
>>>>>> sscanf(str, "%[^0-9]%3d%*", pref, &seq);
>>>>>> sprintf(str, "%s%03d", pref, ++seq);
>>>>>> }
>>>>>> else
>>>>>> sprintf(str, "%s%03d", pref, 1);
>>>>>>
>>>>>> pclose(fp);
>>>>>>
>>>>>> if((f = fopen(str, "r")) == NULL)
>>>>>> {
>>>>>> if((f = fopen(str, "w")) == NULL)
>>>>>> printf("cannot create %s", str);
>>>>>> }
>>>>>> else
>>>>>> printf("%s already exist", str);
>>>>>>
>>>>>> if(f != NULL) fclose(f);
>>>>>> }
>>>>>> else
>>>>>> printf("cannot open process");
>>>>>>
>>>>>> return 0;
>>>>>> }
>>>>>>
>>>>>> This piece of code is only used to give the idea and is not well
>>>>>> tested.
>>>>>
>>>>>
>>>>> that is almost for sure bad - its liek running separate console
>>>>> program
>>>>> to add two strings or numbers
>>>>>
>>>>
>>>> I knew you would have given a similar answer but if you agree to open
>>>> thousands of files to find the last of them, then you could accept that
>>>> solution. It does not only do what you say because the system call is
>>>> looking for the file for patterns and reverses the order of the list.
>>>> All things you should do in your program. In any case, on Windows
>>>> systems there are FindFirst/FindNext functions for this type of
>>>> operations. Below is an example where I replace the system call with a
>>>> function that uses the functions given before. The convenience of the
>>>> system call is that on systems *nix works by simply replacing the call
>>>> with "/usr/bin/ls -1r .......".
>>>>
>>>> #include <stdio.h>
>>>> #include <limits.h>
>>>> #include <stdbool.h>
>>>> #include <windows.h>
>>>>
>>>> bool FindLastOf(char [], char *);
>>>>
>>>> int main()
>>>> {
>>>> char pref[] = "bmp_file_",
>>>> f2find[50],
>>>> str[PATH_MAX];
>>>> int seq;
>>>> FILE *f;
>>>>
>>>> sprintf(f2find, "%s????", pref);
>>>> if(FindLastOf(f2find, str))
>>>> {
>>>> sscanf(str, "%[^0-9]%4d%*", pref, &seq);
>>>> sprintf(str, "%s%04d", pref, ++seq);
>>>> }
>>>> else
>>>> sprintf(str, "%s%04d", pref, 1);
>>>>
>>>> if((f = fopen(str, "r")) == NULL)
>>>> {
>>>> if((f = fopen(str, "w")) == NULL)
>>>> printf("cannot create %s", str);
>>>> }
>>>> else
>>>> printf("%s already exist", str);
>>>>
>>>> if(f != NULL) fclose(f);
>>>>
>>>> return 0;
>>>> }
>>>>
>>>> bool FindLastOf(char what[], char *result)
>>>> {
>>>> WIN32_FIND_DATA fdF;
>>>> HANDLE hF= NULL;
>>>> bool ret = false;
>>>>
>>>> *result = '\0';
>>>> if((hF = FindFirstFile(what, &fdF)) != INVALID_HANDLE_VALUE)
>>>> {
>>>> do
>>>> if(strcmp(fdF.cFileName, result) > 0)
>>>> strcpy(result, fdF.cFileName);
>>>> while(FindNextFile(hF, &fdF));
>>>> ret = true;
>>>> FindClose(hF);
>>>> }
>>>> return ret;
>>>> }
>>>>
>>>> Not even this piece of code is well tested and is just an example.
>>>>
>>>> Unfortunately, on the systems where the opendir/readir functions are
>>>> available instead of FindFirst/FindFext, the work will be more
>>>> difficult
>>>> because they do not have the receipt for patterns.
>>>>
>>>
>>> im not sure what you do your style is unclear to me esp i found name
>>> FindLastOf possibly misleading - what last of it founds?
>>>
>>>
>>> wait a bit maybe i will wrote you how i would od it i got my library
>>> sickle.c which is able to read list of those names to container in ram
>>> and then operate on this
>>>
>>
>>
>> i see i posted it in wrong place so here it should be
>>
>> > 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
>
> ok. Your code creates a list with all the file names. If I run mine,
> however, it looks for the alphabetically greater file with
> "bmp_File_????" search-pattern, acquires the Counter from the name and
> increases it to give the name to the next file, then creates it. So if
> you run the program in an empty directory the first time it will create
> a file called "bmp_file_0001" and every time you run the file in the
> same directory it will create a new file with the counter increased.
>
> bmp_File_0001
> bmp_File_0002
> bmp_File_0003
> bmp_File_0004
> bmp_File_0005
> and so on...
>
ok, though you use quite different style of c coding compared to my


Click here to read the complete article
Re: saving fileXXX.bmp

<uu0rji$2pd5k$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34794&group=comp.lang.c#34794

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!nyheter.lysator.liu.se!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: nos...@please.ty (jak)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Wed, 27 Mar 2024 11:15:13 +0100
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <uu0rji$2pd5k$1@dont-email.me>
References: <utpl9q$2u0jk$1@i2pn2.org> <utq5qj$2ummn$1@i2pn2.org>
<utq6qd$jtaq$1@dont-email.me> <utrbig$30267$3@i2pn2.org>
<utsfnb$18bvo$1@dont-email.me> <utu3qg$33j67$1@i2pn2.org>
<utu9v8$33qfv$2@i2pn2.org> <utv1e1$28rsc$1@dont-email.me>
<uu0qnk$3714j$1@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 27 Mar 2024 10:15:15 +0100 (CET)
Injection-Info: dont-email.me; posting-host="7479a10156a4b94c2674c79a0dcab214";
logging-data="2929844"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Wz4CMzdUQBX1jGQPOomqw"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.18.1
Cancel-Lock: sha1:IdZuHYLnsnShG3EjZld0ruRJicM=
In-Reply-To: <uu0qnk$3714j$1@i2pn2.org>
 by: jak - Wed, 27 Mar 2024 10:15 UTC

fir ha scritto:
>
> i do not love to much those clib functions on working on strings and
> memcopy etc and i rather write my own (except printf, sprintf)

I don't like those functions too. I only use them for attempts and
examples to reduce code lines.

Re: saving fileXXX.bmp

<uu11nm$37aof$1@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34800&group=comp.lang.c#34800

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!.POSTED!not-for-mail
From: fir...@grunge.pl (fir)
Newsgroups: comp.lang.c
Subject: Re: saving fileXXX.bmp
Date: Wed, 27 Mar 2024 12:59:51 +0100
Organization: i2pn2 (i2pn.org)
Message-ID: <uu11nm$37aof$1@i2pn2.org>
References: <utpl9q$2u0jk$1@i2pn2.org> <utq5qj$2ummn$1@i2pn2.org> <utq6qd$jtaq$1@dont-email.me> <utrbig$30267$3@i2pn2.org> <utsfnb$18bvo$1@dont-email.me> <utu3qg$33j67$1@i2pn2.org> <utu9v8$33qfv$2@i2pn2.org> <utv1e1$28rsc$1@dont-email.me> <uu0qnk$3714j$1@i2pn2.org> <uu0rji$2pd5k$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 27 Mar 2024 11:59:51 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="3386127"; 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: <uu0rji$2pd5k$1@dont-email.me>
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: fir - Wed, 27 Mar 2024 11:59 UTC

jak wrote:
> fir ha scritto:
>>
>> i do not love to much those clib functions on working on strings and
>> memcopy etc and i rather write my own (except printf, sprintf)
>
> I don't like those functions too. I only use them for attempts and
> examples to reduce code lines.
>
>
still you could write names in pascal i guess thet describe what they do
becouse honsetly seing them i dont know immediatelly what they do as
i dont know them all (as i not use them or rarely)

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor