SDDSlib
Loading...
Searching...
No Matches
pad_with_spaces.c File Reference

Provides functionality to manipulate and format strings. More...

#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.
 

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.

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}