The outage for Sunday 24th November has been cancelled.
Bioplib
Protein Structure C Library
 All Data Structures Files Functions Variables Typedefs Macros Pages
stringcat.c
Go to the documentation of this file.
1 /************************************************************************/
2 /**
3 
4  \file StringCat.c
5 
6  \version V1.1
7  \date 04.06.15
8  \brief
9 
10  \copyright (c) UCL / Dr. Andrew C. R. Martin 2015
11  \author Dr. Andrew C. R. Martin
12  \par
13  Institute of Structural & Molecular Biology,
14  University College London,
15  Gower Street,
16  London.
17  WC1E 6BT.
18  \par
19  andrew@bioinf.org.uk
20  andrew.martin@ucl.ac.uk
21 
22 **************************************************************************
23 
24  This code is NOT IN THE PUBLIC DOMAIN, but it may be copied
25  according to the conditions laid out in the accompanying file
26  COPYING.DOC.
27 
28  The code may be modified as required, but any modifications must be
29  documented so that the person responsible can be identified.
30 
31  The code may not be sold commercially or included as part of a
32  commercial product except as described in the file COPYING.DOC.
33 
34 **************************************************************************
35 
36  Description:
37  ============
38 
39 
40 **************************************************************************
41 
42  Usage:
43  ======
44 
45 **************************************************************************
46 
47  Revision History:
48  =================
49 - V1.0 26.03.15 Original By:ACRM
50 - V1.1 04.06.15 Fixed bug in counting number of characters to copy
51 
52 *************************************************************************/
53 /* Doxygen
54  -------
55  #GROUP General Programming
56  #SUBGROUP String handling
57  #FUNCTION blStrncat()
58  Like strncat() but takes the max number of characters that the
59  output string can hold rather than the maximum number of characterss
60  to be appended.
61 */
62 /************************************************************************/
63 /* Includes
64 */
65 #include <ctype.h>
66 #include <string.h>
67 
68 /************************************************************************/
69 /* Defines and macros
70 */
71 
72 /************************************************************************/
73 /* Globals
74 */
75 
76 /************************************************************************/
77 /* Prototypes
78 */
79 
80 
81 /************************************************************************/
82 /*>char *blStrncat(char *out, const char *in, size_t len)
83  ------------------------------------------------------
84 *//**
85 
86  \param[in] *in Input string to be appended
87  \param[in] len Length of output string
88  \param[in,out] *out String that we are appending to
89 
90  A simpler version of strncat. strncat takes the max number of chars
91  to be appended whereas this takes the max number of chars that 'out'
92  can hold.
93 
94 - 16.01.15 Original By: ACRM
95 - 04.06.15 Fixed - was subtracting the input string length as well!
96 */
97 char *blStrncat(char *out, const char *in, size_t len)
98 {
99  int lenOut, cpLen;
100 
101  lenOut = strlen(out);
102  cpLen = len - lenOut;
103 
104  strncat(out, in, cpLen);
105  return(out);
106 }
char * blStrncat(char *out, const char *in, size_t len)
Definition: stringcat.c:97