[ create a new paste ] login | about

Link: http://codepad.org/8Sy6nZFR    [ raw code | output | fork ]

C, pasted on Dec 18:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
#include <string.h>

int main(void)
{
 int n, p;
 char *ptr, str[255] = "The mask. Hello Moon ! Disabled DMA, soundman.";
 char  buf[64] = {'\0'};
//printf("in str: ");
//gets(str);

 n = p = 0;
 for(ptr = str; sscanf(ptr, "%[^.!?]%n", buf, &p) == 1; ptr += p + 1, ++n) 
      puts(buf);
 printf("count: %d\n", n);
 return 0;
}


Output:
1
2
3
4
The mask
 Hello Moon 
 Disabled DMA, soundman
count: 3


Create a new paste based on this one


Comments: