SDDS ToolKit Programs and Libraries for C and Python
All Classes Files Functions Variables Macros Pages
pad_with_spaces.c File Reference

Detailed Description

Provides functionality to manipulate and format strings.

License
This file is distributed under the terms of the Software License Agreement found in the file LICENSE included with this distribution.
Author
M. Borland, C. Saunders, R. Soliday

Definition in file pad_with_spaces.c.

#include "mdb.h"

Go to the source code of this file.

Functions

char * pad_with_spaces (char *s, int n)
 Adds a specified number of spaces to the end of a string.
 

Function Documentation

◆ pad_with_spaces()

char * pad_with_spaces ( char * s,
int n )

Adds a specified number of spaces to the end of a string.

This function appends n spaces to the end of the input string s.

Parameters
sPointer to the null-terminated string to be padded.
nThe number of spaces to add to the end of the string.
Returns
Pointer to the padded string s.

Definition at line 27 of file pad_with_spaces.c.

27 {
28 char *ptr;
29
30 ptr = s + strlen(s);
31 while (n--)
32 *ptr++ = ' ';
33 *ptr = 0;
34 return (s);
35}