Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Strings in C - help
12-05-2012, 07:27 PM,
#32
RE: Strings in C - help
I am a person who reads datasheets and documentation more than anyone I know.

I did look at the documentation for strcpy() prior to ever using it, many times.

Here is what I got from a C++ online reference (I know we don't compile in C++ but I understood that basic functions were the same):
Code:
function
strcpy<cstring>char * strcpy ( char * destination, const char * source );Copy string
Copies the C string pointed by source into the array pointed by destination, including the terminating null character.

To avoid overflows, the size of the array pointed by destination shall be long enough to contain the same C string as source (including the terminating null character), and should not overlap in memory with source.

I took this to mean that it added the null, not just if you happened to include the last character of source in the copied characters.

I must be getting a null from somewhere because it has not hiccuped once yet.

But actually I did have to research elsewhere to find out that strcpy() can be used to copy partial strings. K&R did not really add to this.

Do you have a good online reference that could be helpful?

Dale
PIC32-Pinguino-OTG Rev C and PIC32-PINGUINO-MICRO rev.B
Win XP SP3
r381 x.3 Big Grin
AND spi.c {} error fixed
AND sdmmc.c pin error fixed
AND diskio.c fixed, MICRO can't use the RTCC
AND analog.c fixed for MICRO
Reply


Messages In This Thread
Strings in C - help - by KiloOne - 10-05-2012, 09:24 PM
RE: Strings in C - help - by mf01 - 10-05-2012, 10:00 PM
RE: Strings in C - help - by KiloOne - 10-05-2012, 10:30 PM
RE: Strings in C - help - by KiloOne - 10-05-2012, 10:06 PM
RE: Strings in C - help - by jpmandon - 10-05-2012, 10:18 PM
RE: Strings in C - help - by mf01 - 10-05-2012, 10:43 PM
RE: Strings in C - help - by KiloOne - 10-05-2012, 10:45 PM
RE: Strings in C - help - by jpmandon - 10-05-2012, 11:30 PM
RE: Strings in C - help - by mf01 - 10-05-2012, 11:32 PM
RE: Strings in C - help - by moreno - 11-05-2012, 06:59 AM
RE: Strings in C - help - by mf01 - 11-05-2012, 09:10 AM
RE: Strings in C - help - by KiloOne - 11-05-2012, 01:38 PM
RE: Strings in C - help - by pingotg - 11-05-2012, 02:46 PM
RE: Strings in C - help - by KiloOne - 11-05-2012, 03:08 PM
RE: Strings in C - help - by mf01 - 11-05-2012, 03:08 PM
RE: Strings in C - help - by pingotg - 11-05-2012, 03:27 PM
RE: Strings in C - help - by KiloOne - 11-05-2012, 03:53 PM
RE: Strings in C - help - by pingotg - 11-05-2012, 07:19 PM
RE: Strings in C - help - by mf01 - 11-05-2012, 03:47 PM
RE: Strings in C - help - by mf01 - 11-05-2012, 03:57 PM
RE: Strings in C - help - by KiloOne - 11-05-2012, 04:23 PM
RE: Strings in C - help - by KiloOne - 11-05-2012, 08:33 PM
RE: Strings in C - help - by moreno - 11-05-2012, 08:53 PM
RE: Strings in C - help - by KiloOne - 13-05-2012, 12:34 AM
RE: Strings in C - help - by pingotg - 11-05-2012, 08:58 PM
RE: Strings in C - help - by KiloOne - 11-05-2012, 09:50 PM
RE: Strings in C - help - by pingotg - 12-05-2012, 09:55 AM
RE: Strings in C - help - by moreno - 12-05-2012, 07:45 AM
RE: Strings in C - help - by KiloOne - 12-05-2012, 03:31 PM
RE: Strings in C - help - by pingotg - 12-05-2012, 05:22 PM
RE: Strings in C - help - by KiloOne - 12-05-2012, 05:40 PM
RE: Strings in C - help - by pingotg - 12-05-2012, 06:11 PM
RE: Strings in C - help - by KiloOne - 12-05-2012, 07:27 PM
RE: Strings in C - help - by pingotg - 13-05-2012, 04:48 PM
RE: Strings in C - help - by bjoernp - 15-05-2012, 05:42 PM
RE: Strings in C - help - by KiloOne - 17-05-2012, 12:09 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)