Created
February 26, 2019 09:30
-
-
Save jshardy/9967872e766dc0c130bee8ca38f6f683 to your computer and use it in GitHub Desktop.
PadString
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************************** | |
* Function: padString(char *string, size_t size, fillchar) | |
* Purpose: padString for writing specific data file | |
* Precondition: pass string, total string size desired, and fillchar | |
* Postcondition: string is padded with fillchar | |
************************************************************************/ | |
void padString(char *string, size_t size, char fillchar) | |
{ | |
size_t i = 0; | |
while(*string != 0) | |
string++, i++; | |
if(i < size) | |
memset(string, fillchar, size - i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment