[ create a new paste ] login | about

Link: http://codepad.org/11YQdsEs    [ raw code | output | fork ]

C, pasted on Dec 25:
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()
{
        char *dateSTR = "234234/345345/23455323";
        int dateINT[3], i;
        
        if ( sscanf(dateSTR, "%d/%d/%d", &dateINT[0], &dateINT[1], &dateINT[2]) == 3)
        {
                printf("Data correcta");
        } else {
                printf("Errado");
        }
        
        return 0;
}


Output:
1
Data correcta


Create a new paste based on this one


Comments: