SDDSlib
Loading...
Searching...
No Matches
pad_with_spaces.c
Go to the documentation of this file.
1/**
2 * @file pad_with_spaces.c
3 * @brief Provides functionality to manipulate and format strings.
4 *
5 * @copyright
6 * - (c) 2002 The University of Chicago, as Operator of Argonne National Laboratory.
7 * - (c) 2002 The Regents of the University of California, as Operator of Los Alamos National Laboratory.
8 *
9 * @license
10 * This file is distributed under the terms of the Software License Agreement
11 * found in the file LICENSE included with this distribution.
12 *
13 * @author M. Borland, C. Saunders, R. Soliday
14 */
15
16#include "mdb.h"
17
18/**
19 * @brief Adds a specified number of spaces to the end of a string.
20 *
21 * This function appends `n` spaces to the end of the input string `s`.
22 *
23 * @param s Pointer to the null-terminated string to be padded.
24 * @param n The number of spaces to add to the end of the string.
25 * @return Pointer to the padded string `s`.
26 */
27char *pad_with_spaces(char *s, int n) {
28 char *ptr;
29
30 ptr = s + strlen(s);
31 while (n--)
32 *ptr++ = ' ';
33 *ptr = 0;
34 return (s);
35}
char * pad_with_spaces(char *s, int n)
Adds a specified number of spaces to the end of a string.