This program will take in an input of "Name:Information." The program will then search through the string until the colon is met and replace the colon with a '\0'. I am only up to this point and wanted to test it to see if I got any problems in which it compiles fine but it falls out when it gets to the line assigning the '\0' character.
Code:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main()
{
char str[50];
char *p;
printf("string in the format \"Name:Information\": ");
fgets( str, sizeof(str), stdin);
p = strchr(str, ':');
if ( p ) *p='\0';
getch();
return 0;
}