473,324 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

c equivilant to "copy"

Greetings,
I've been trying to find an equivant c funtion to the c++ copy function.

Description:

copy(char *cstring, size_t count, size_t offset);

Copies "count" characters from a C-style string starting at offset.
Let's say I have the string "Hello There" and I needed only the "llo" part
from hello. How would I accomplish this? Using the c++ I could use the
copy function.

Any help would be appreciated,
Thanks!
Nov 14 '05 #1
27 2238
Shagy wrote:
Greetings,
I've been trying to find an equivant c funtion to the c++ copy function.

Description:

copy(char *cstring, size_t count, size_t offset);

Copies "count" characters from a C-style string starting at offset.
Let's say I have the string "Hello There" and I needed only the "llo" part
from hello. How would I accomplish this? Using the c++ I could use the
copy function.

Any help would be appreciated,
Thanks!

Probably what you are asking ...

strncpy(dest, cstring + offset, count);
dest[count] = '\0';

assuming dest in large enough to hold 'count + 1' character.

Krishanu

Nov 14 '05 #2
Krishanu Debnath wrote:

Shagy wrote:
Greetings,
I've been trying to find an equivant c funtion to
the c++ copy function.

Description:

copy(char *cstring, size_t count, size_t offset);

Copies "count" characters from a C-style string starting at offset.
Let's say I have the string "Hello There"
and I needed only the "llo" part from hello.
How would I accomplish this?
Using the c++ I could use the copy function.
Probably what you are asking ...

strncpy(dest, cstring + offset, count);
dest[count] = '\0';

assuming dest in large enough to hold 'count + 1' character.


Since you are not copying an entire string,
memcpy would work just as well as strncpy.

/* BEGIN new.c */

#include <string.h>
#include <stdio.h>

int main(void)
{
char dest[sizeof "llo"];
size_t count;

count = sizeof dest - 1;
memcpy(dest, "Hello There" + 2, count);
dest[count] = '\0';
puts(dest);
return 0;
}

/* END new.c */
Nov 14 '05 #3
Thanks!!!

Both examples work great!!!

Shagy

"Shagy" <no*****@noemail.com> wrote in message
news:cs**********@nic.grnet.gr...
Greetings,
I've been trying to find an equivant c funtion to the c++ copy function.

Description:

copy(char *cstring, size_t count, size_t offset);

Copies "count" characters from a C-style string starting at offset.
Let's say I have the string "Hello There" and I needed only the "llo"
part from hello. How would I accomplish this? Using the c++ I could use
the copy function.

Any help would be appreciated,
Thanks!

Nov 14 '05 #4
Shagy wrote:

I've been trying to find an equivant c funtion to the c++ copy
function.

Description:

copy(char *cstring, size_t count, size_t offset);

Copies "count" characters from a C-style string starting at
offset.

Let's say I have the string "Hello There" and I needed only
the "llo" part from hello. How would I accomplish this? Using
the c++ I could use the copy function.


char *strncpy(char *dest, const char *src, size_t max);

is available in <strings.h>. The corresponding usage would be:

dest = strncpy(dest, src + offset, max);

and you can obviously omit the "dest =" portion. In your example:

strncpy(dest, "Hello There" + 2, 3);

However you will get better and safer results by using strlcpy (and
strlcat) as proposed by the BSD group. You can find an
implementation, justification, and description at:

<http://cbfalconer.home.att.net/download/strlcpy.zip>

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #5
On Thu, 13 Jan 2005 16:57:47 +0000, CBFalconer wrote:
Shagy wrote:

I've been trying to find an equivant c funtion to the c++ copy
function.

Description:

copy(char *cstring, size_t count, size_t offset);

Copies "count" characters from a C-style string starting at
offset.

Let's say I have the string "Hello There" and I needed only
the "llo" part from hello. How would I accomplish this? Using
the c++ I could use the copy function.
char *strncpy(char *dest, const char *src, size_t max);


But be aware that strncpy() is a dangerous function for the unwary, it
doesn't always null terminate the destination string. strncat() is better.
is available in <strings.h>. The corresponding usage would be:
That would be <string.h>
dest = strncpy(dest, src + offset, max);

and you can obviously omit the "dest =" portion. In your example:

strncpy(dest, "Hello There" + 2, 3);


dest[0] = '\0';
strncat(dest, "Hello There" + 2, 3);

is a better approach. In this case as others have mentioned memcpy() is
another possibility as in

memcpy(dest, "Hello There" + 2, 3);
dest[3] = '\0';

Also consider sprintf()

sprintf(dest, "%.3s", "Hello There" + 2);

The real benefit of sprintf() can be seen if this is just a part of
building a more complex string.

Lawrence
Nov 14 '05 #6
Krishanu Debnath wrote:
Probably what you are asking ...

strncpy(dest, cstring + offset, count);
dest[count] = '\0';

assuming dest in large enough to hold 'count + 1' character.

Krishanu


My favorite way of doing this is:

strncpy( dest, cstring + offset, count )[count] = '\0';

It works because strncpy() returns the address of the dest argument.

--
Regards,
Stan Milam
================================================== ===========
Charter Member of The Society for Mediocre Guitar Playing on
Expensive Instruments, Ltd.
================================================== ===========
Nov 14 '05 #7
Stan Milam <st*****@swbell.net> writes:
My favorite way of doing this is:

strncpy( dest, cstring + offset, count )[count] = '\0';

It works because strncpy() returns the address of the dest argument.


cool. ;-)

Can someone give an example that strncpy() would be safer than strcpy() ?
Should we never use strcpy() ?

--
William
Nov 14 '05 #8
On Mon, 17 Jan 2005 16:01:24 +0800, William Xuuu
<wi**********@163.com> wrote:
Stan Milam <st*****@swbell.net> writes:
My favorite way of doing this is:

strncpy( dest, cstring + offset, count )[count] = '\0';

It works because strncpy() returns the address of the dest argument.
cool. ;-)

Can someone give an example that strncpy() would be safer than strcpy() ?


#include <stdio.h>

void func(const char *str)
{
char buff[10];
strcpy(buff, str);
printf("%s\n", buff);
}

int main(int argc, char **argv)
{
if (argc > 1)
func(argv[1]);
return 0;
}

If the user runs this with parameter "1234567890", the buffer will
overflow (10 characters plus the terminating '\0'), as it will with a
longer string. In the Real World(tm) user input can't be guaranteed to
be right. If the strcpy were replaced by

strncpy(buff, str, 9)[9[ = '\0';

the program would be safe. (In practice, of course, you might want to
detect the overflow and report it as an error, and to use sizeof(buff)-1
instead of an explicit value.)
Should we never use strcpy() ?


strcpy() is completely safe to use /if/ you know that the string will
fit. Most of the time in my programs I know that the string will fit
because I have done checks elsewhere, or because I have just allocated
memory to the size of the string:

char *strDup(const char *str)
{
char *p = malloc(strlen(str) + 1);
if (p)
return strcpy(p, str);
return NULL;
}

Note that strcat also has the problem that the buffer can overflow, and
it's messy and wasteful to use strncat to detect that (since strncat
takes the number of characters to be copied not the length of the
buffer, so you still have to do strlen(buff) to determine whether the
string will fit).

Also, strncpy() will pad out the rest of the buffer with nul ('\0')
characters. Most of the time this is wasteful, especially if using a
big buffer with a small source string many times.

Because of these faults, the functions strlcpy() and strlcat() were
introduced in OpenBSD 2.4, and many of us hope that they will be
incorporated into a future C standard revision. See

http://www.courtesan.com/todd/papers/strlcpy.html

for example (the functions are easy to write, or you can use the OpenBSD
source under their Free Software licence).

Chris C
Nov 14 '05 #9
Chris Croughton wrote:
.... snip ...
Because of these faults, the functions strlcpy() and strlcat() were
introduced in OpenBSD 2.4, and many of us hope that they will be
incorporated into a future C standard revision. See

http://www.courtesan.com/todd/papers/strlcpy.html

for example (the functions are easy to write, or you can use the
OpenBSD source under their Free Software licence).


Or you can use my implementation (in portable code, which I have
put in the public domain) found at:

<http://cbfalconer.home.att.net/download/strlcpy.zip>

The point is that they are much safer. If your system already
provides them, use them. If not it is almost always safe to use
those reserved names (I know of no exceptions).

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #10
On Mon, 17 Jan 2005 14:33:37 GMT, CBFalconer
<cb********@yahoo.com> wrote:
Chris Croughton wrote:
... snip ...

Because of these faults, the functions strlcpy() and strlcat() were
introduced in OpenBSD 2.4, and many of us hope that they will be
incorporated into a future C standard revision. See

http://www.courtesan.com/todd/papers/strlcpy.html

for example (the functions are easy to write, or you can use the
OpenBSD source under their Free Software licence).


Or you can use my implementation (in portable code, which I have
put in the public domain) found at:

<http://cbfalconer.home.att.net/download/strlcpy.zip>


My ones use memmove so they are safe against overlapping strings, but I
see why you didn't want to use other library functions (my code uses the
Zlib licence, which is about as free as it gets without being PD). I
notice you include the page I pointed to.
The point is that they are much safer. If your system already
provides them, use them. If not it is almost always safe to use
those reserved names (I know of no exceptions).


Solaris and some of the BSD variants already have them in string.h If
the prototypes are compatible (for instance no one using the restrict
keyword on the pointers) there shouldn't be a problem with including the
header file as well as string.h.

Chris C
Nov 14 '05 #11
Stan Milam <st*****@swbell.net> wrote:
Krishanu Debnath wrote:
strncpy(dest, cstring + offset, count);
dest[count] = '\0';

assuming dest in large enough to hold 'count + 1' character.


My favorite way of doing this is:

strncpy( dest, cstring + offset, count )[count] = '\0';


Well, thanks a lot for propagating the idea that we C programmers create
write-only code :-/

Richard
Nov 14 '05 #12
On Sat, 15 Jan 2005 00:41:47 +0000, Stan Milam wrote:
Krishanu Debnath wrote:
Probably what you are asking ...

strncpy(dest, cstring + offset, count);
dest[count] = '\0';

assuming dest in large enough to hold 'count + 1' character.

Krishanu


My favorite way of doing this is:

strncpy( dest, cstring + offset, count )[count] = '\0';


It is best to avoid strncpy() completely. It isn't a "true" string
function as it *always* writes out exactly the number of characters
specified by the 3rd argument. This means that the result may not be null
termnated (hence the extra write you need to do) or it may end up writing
a whole load of unnecessary null characters after the string data. If you
want to do it in one statement you can use sprintf() or

*dest = '\0', strncat( dest, cstring + offset, count );

Lawrence
Nov 14 '05 #13
bd
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

CBFalconer wrote:

[snip]
However you will get better and safer results by using strlcpy (and
strlcat) as proposed by the BSD group. You can find an
implementation, justification, and description at:

<http://cbfalconer.home.att.net/download/strlcpy.zip>


Until this becomes standard one must not use it in ANSI/ISO C comforming
programs, as it intrudes upon the str*() namespace.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFB7BZS+hz2VlChukwRAkV4AJ9RSs/cdfx1vwnw9t64mGo6k3HYswCfYcdk
n+A4IQXI6M/7M66UM7ggeuE=
=bL30
-----END PGP SIGNATURE-----
Nov 14 '05 #14
bd wrote:
CBFalconer wrote:

[snip]
However you will get better and safer results by using strlcpy
(and strlcat) as proposed by the BSD group. You can find an
implementation, justification, and description at:

<http://cbfalconer.home.att.net/download/strlcpy.zip>


Until this becomes standard one must not use it in ANSI/ISO C
comforming programs, as it intrudes upon the str*() namespace.


If it creates a difficulty, rename the functions. You have the
complete source. In practice there will be no problem unless the
existing system already implements them.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #15
Chris Croughton <ch***@keristor.net> writes:

[...]
Because of these faults, the functions strlcpy() and strlcat() were
introduced in OpenBSD 2.4, and many of us hope that they will be
incorporated into a future C standard revision. See

http://www.courtesan.com/todd/papers/strlcpy.html

for example (the functions are easy to write, or you can use the OpenBSD
source under their Free Software licence).


That helps a lot, thanks!

--
William
Nov 14 '05 #16
Wouldn't a function like this give you safety and NUL-termination?

char *mystrncpy(char *dest, const char *src, size_t size)
{
*dest = '\0';
return strncat(dest, src, size-1);
}

Nov 14 '05 #17
jake1138 wrote:

Wouldn't a function like this give you safety and NUL-termination?

char *mystrncpy(char *dest, const char *src, size_t size)
{
*dest = '\0';
return strncat(dest, src, size-1);
}


no. Think about it.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #18
CBFalconer <cb********@yahoo.com> wrote:
jake1138 wrote:

Wouldn't a function like this give you safety and NUL-termination?

char *mystrncpy(char *dest, const char *src, size_t size)
{
*dest = '\0';
return strncat(dest, src, size-1);
}


no. Think about it.


Ok, I've thought about it. Given

char s1[20];
char s2[]="abcdefghijklmnopqrstuvwxyz";

how is

mystrcpy(s1, s2, 20);

less safe than

strlcpy(s1, s2, 20);

and how is

strlcpy(s1, s2, 26);

safer than

strlcpy(s1, s2, 26);

Richard
Nov 14 '05 #19
Richard Bos wrote:
CBFalconer <cb********@yahoo.com> wrote:
jake1138 wrote:

Wouldn't a function like this give you safety and NUL-termination?

char *mystrncpy(char *dest, const char *src, size_t size)
{
*dest = '\0';
return strncat(dest, src, size-1);
}
no. Think about it.


Ok, I've thought about it. Given

char s1[20];
char s2[]="abcdefghijklmnopqrstuvwxyz";

how is

mystrcpy(s1, s2, 20);

less safe than

strlcpy(s1, s2, 20);


mystrcpy leaves an unterminated string (no '\0') in s1, and returns
a pointer to s1, which will almost certainly lead to future
faults. strlcpy leaves a terminated string in s1, and returns 26
to indicate the size required. Since 26 >= 20 you know the output
was truncated.

and how is

strlcpy(s1, s2, 26);

safer than

strlcpy(s1, s2, 26);


These are identical, and are lying to strlcpy about the space
available.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #20

CBFalconer wrote:
Richard Bos wrote:
CBFalconer <cb********@yahoo.com> wrote:
jake1138 wrote:

Wouldn't a function like this give you safety and NUL-termination?
char *mystrncpy(char *dest, const char *src, size_t size)
{
*dest = '\0';
return strncat(dest, src, size-1);
}

no. Think about it.


Ok, I've thought about it. Given

char s1[20];
char s2[]="abcdefghijklmnopqrstuvwxyz";

how is

mystrcpy(s1, s2, 20);

less safe than

strlcpy(s1, s2, 20);


mystrcpy leaves an unterminated string (no '\0') in s1, and returns
a pointer to s1, which will almost certainly lead to future
faults. strlcpy leaves a terminated string in s1, and returns 26
to indicate the size required. Since 26 >= 20 you know the output
was truncated.


I don't see how mystrncpy (it has an 'n' in it) will leave an
unterminated string. s1[0] is immediately set to '\0', then strncat
will write over that up to size-1 length then add a '\0' on the end.
I've tested this and it seems to work as expected. Please explain.

Nov 14 '05 #21
Richard Bos wrote:

CBFalconer <cb********@yahoo.com> wrote:
jake1138 wrote:

Wouldn't a function like this give you safety and NUL-termination?

char *mystrncpy(char *dest, const char *src, size_t size)
{
*dest = '\0';
return strncat(dest, src, size-1);
}


no. Think about it.


Ok, I've thought about it. Given

char s1[20];
char s2[]="abcdefghijklmnopqrstuvwxyz";

how is

mystrcpy(s1, s2, 20);

less safe than

strlcpy(s1, s2, 20);

mystrcpy(s1, s2, 0);

isn't safe.

--
pete
Nov 14 '05 #22
jake1138 wrote:
CBFalconer wrote:
Richard Bos wrote:
CBFalconer <cb********@yahoo.com> wrote:
jake1138 wrote:
>
> Wouldn't a function like this give you safety and
> NUL-termination?
>
> char *mystrncpy(char *dest, const char *src, size_t size)
> {
> *dest = '\0';
> return strncat(dest, src, size-1);
> }

no. Think about it.

Ok, I've thought about it. Given

char s1[20];
char s2[]="abcdefghijklmnopqrstuvwxyz";

how is

mystrcpy(s1, s2, 20);

less safe than

strlcpy(s1, s2, 20);


mystrcpy leaves an unterminated string (no '\0') in s1, and returns
a pointer to s1, which will almost certainly lead to future
faults. strlcpy leaves a terminated string in s1, and returns 26
to indicate the size required. Since 26 >= 20 you know the output
was truncated.


I don't see how mystrncpy (it has an 'n' in it) will leave an
unterminated string. s1[0] is immediately set to '\0', then strncat
will write over that up to size-1 length then add a '\0' on the end.
I've tested this and it seems to work as expected. Please explain.


Sorry, I was confusing the internal action of strncat with that of
strncpy, and I just looked it up. You were right about the
safety. You don't have the advantage of getting back the length
info that strlcpy/cat provide.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #23

In article <11*********************@f14g2000cwb.googlegroups. com>, "jake1138" <co******@gmail.com> writes:
CBFalconer wrote:
Richard Bos wrote:
CBFalconer <cb********@yahoo.com> wrote:
> jake1138 wrote:
>>
>> Wouldn't a function like this give you safety and NUL-termination?
>>
>> char *mystrncpy(char *dest, const char *src, size_t size)
>> {
>> *dest = '\0';
>> return strncat(dest, src, size-1);
>> }
>
> no. Think about it.

mystrcpy leaves an unterminated string (no '\0') in s1, and returns
a pointer to s1, which will almost certainly lead to future
faults. strlcpy leaves a terminated string in s1, and returns 26
to indicate the size required. Since 26 >= 20 you know the output
was truncated.


I don't see how mystrncpy (it has an 'n' in it) will leave an
unterminated string.


In the normal case it won't. Perhaps Chuck is thinking that strncat
has the same brain-dead behavior as strncpy when the copy length is
smaller than the source length; it doesn't. (It has other
infelicities.)

However, mystrncpy still has problems:

- As Chuck noted, it doesn't tell you if truncation occurred, unlike
strlcpy. This isn't a bug, but one could argue that it makes
mystrncpy inferior to strlcpy. (Some prefer returning the
destination string for "chaining" purposes.)

- If size == 0, you're in trouble.

- If I were writing "safe" versions of the string-handling functions,
you can be damn sure that I'd have them do something sensible with
null arguments.

--
Michael Wojcik mi************@microfocus.com

Pocket #9: A complete "artificial glen" with rocks, and artificial moon,
and forester's station. Excellent for achieving the effect of the
sublime without going out-of-doors. -- Joe Green
Nov 14 '05 #24

Michael Wojcik wrote:
In article <11*********************@f14g2000cwb.googlegroups. com>, "jake1138" <co******@gmail.com> writes:
CBFalconer wrote:
Richard Bos wrote:
> CBFalconer <cb********@yahoo.com> wrote:
>> jake1138 wrote:
>>>
>>> Wouldn't a function like this give you safety and NUL-termination? >>>
>>> char *mystrncpy(char *dest, const char *src, size_t size)
>>> {
>>> *dest = '\0';
>>> return strncat(dest, src, size-1);
>>> }
>>
>> no. Think about it.
>
mystrcpy leaves an unterminated string (no '\0') in s1, and returns a pointer to s1, which will almost certainly lead to future
faults. strlcpy leaves a terminated string in s1, and returns 26
to indicate the size required. Since 26 >= 20 you know the output was truncated.


I don't see how mystrncpy (it has an 'n' in it) will leave an
unterminated string.


In the normal case it won't. Perhaps Chuck is thinking that strncat
has the same brain-dead behavior as strncpy when the copy length is
smaller than the source length; it doesn't. (It has other
infelicities.)

However, mystrncpy still has problems:

- As Chuck noted, it doesn't tell you if truncation occurred, unlike
strlcpy. This isn't a bug, but one could argue that it makes
mystrncpy inferior to strlcpy. (Some prefer returning the
destination string for "chaining" purposes.)

- If size == 0, you're in trouble.

- If I were writing "safe" versions of the string-handling functions,
you can be damn sure that I'd have them do something sensible with
null arguments.

--
Michael Wojcik mi************@microfocus.com

Pocket #9: A complete "artificial glen" with rocks, and artificial

moon, and forester's station. Excellent for achieving the effect of the
sublime without going out-of-doors. -- Joe Green


All good points, from everyone. I didn't think about size==0, that
should be checked. Also, to make this work like strlcpy, I'd have to
use strlen, which would make it slower. Or do the copy manually with a
count, which I assume strlcpy does. I'll take a look at the
implementation of strlcpy.

Nov 14 '05 #25
mw*****@newsguy.com (Michael Wojcik) wrote:
- If I were writing "safe" versions of the string-handling functions,
you can be damn sure that I'd have them do something sensible with
null arguments.


strlcpy() silently and transparently covers up the bug of using a null
pointer as if it were a string - I wouldn't call that "something
sensible". I'd rather catch my bugs now rather than when the program has
gone into production.

Richard
Nov 14 '05 #26
Richard Bos wrote:
mw*****@newsguy.com (Michael Wojcik) wrote:
- If I were writing "safe" versions of the string-handling
functions, you can be damn sure that I'd have them do
something sensible with null arguments.


strlcpy() silently and transparently covers up the bug of using
a null pointer as if it were a string - I wouldn't call that
"something sensible". I'd rather catch my bugs now rather than
when the program has gone into production.


That is not necessarily so. It does apply to my implementation,
and is so documented therein. My source is easily augmented to
produce UB in that case.

This sort of thing is not uncommon, and leads to long
non-productive arguments. When you have the source (mine has been
put in public domain) you can adjust to suit your personal
preferance. In general it is harder to allow for suitable action
on such a parameter value, here, IIRC, it was trivially easy. My
source is at:

<http://cbfalconer.home.att.net/download/strlcpy.zip>

and has some minor errors in the readme, such as compile flags.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #27

In article <41***************@news.individual.net>, rl*@hoekstra-uitgeverij.nl (Richard Bos) writes:
mw*****@newsguy.com (Michael Wojcik) wrote:
- If I were writing "safe" versions of the string-handling functions,
you can be damn sure that I'd have them do something sensible with
null arguments.


strlcpy() silently and transparently covers up the bug of using a null
pointer as if it were a string - I wouldn't call that "something
sensible". I'd rather catch my bugs now rather than when the program has
gone into production.


It's only a bug if it's a violation of the design. If by design
my program uses null character pointers and empty strings
interchangeably in some contexts, then there's nothing wrong with
the behavior of strlcpy in those contexts.

And, of course, "something sensible" could be aborting. What's not
sensible is UB. I can accept that the standard left behavior
undefined for strcpy et al, because that could be useful for
optimized implementations, but if I'm writing my own functions I
check parameters.

Frankly, it's exceedingly rare that one of the functions in any of
my current projects flags an invalid parameter - that indicates a
logic error in the caller. But it gets handled cleanly, and the
program - which is certainly doing other things, unrelated to the
error - continues running. That's far better than UB.

--
Michael Wojcik mi************@microfocus.com

Duck: No secret what's worth a hoot ought to be kept quiet.
Pogo: Secrets is usually perty doggone fascinatin'.
Duck: Egg-zackly ... it's completely illogical to keep a secret secret.
Pogo: An' unfair. -- Walt Kelly
Nov 14 '05 #28

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Nick Jacobson | last post by:
This question is with regard to the * operator as used for sequence concatenation. There's the well-known gotcha: a = ] b = a*3 b = 4 print b
0
by: Kevin Schneider | last post by:
Please forgive me if this is a bit off topic, but I haven't had any takers in other forums. With ASP.NET projects, is it possible to have VS.NET automatically change the configuration options of...
4
by: Don Wash | last post by:
Hi There! I'm using "Copy Project" function of VS.NET to upload my ASP.NET application to my web server (not my own web server) and they have Front Page Server Extensions installed as well....
1
by: Knepper, Michelle | last post by:
Hi out there, I'm a first-time user of the "Copy ... From..." command, and I'm trying to load a table from a text flat file. http://www.postgresql.org/docs/7.4/static/sql-copy.html I don't...
1
by: Russell Warren | last post by:
I just did a comparison of the copying speed of shutil.copy against the speed of a direct windows copy using os.system. I copied a file that was 1083 KB. I'm very interested to see that the...
2
by: Hexman | last post by:
Hello All, I receive many files with similar content each day. All I want to do is copy them into one file, then I'll use that file for my processes. Using vb2005. I've tried: Shell("copy...
1
by: Özden Irmak | last post by:
Hello, Does anybody know a way to get the local equvalents of strings used by explorer such as "Cut","Copy","Paste" ? Thanks in advance... Regards, Özden Irmak
3
by: Jess | last post by:
Hello, The C++ reference says the return result of "copy" is an output iterator. I'm wondering how I can assign the returned iterator to some other iterator. I tried int main(){ string...
1
by: hartattack72 | last post by:
Hello. I am new to access, but have had great success in creating an application. My one user is requesting a function to save time in data entry... and I am stumped being the plebian that I am. ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.