Listing 6 This program expects a line containing a string, followed by two integers, followed by another string, all separated by commas.

#include <stdio.h>

#define MAXLINE 80

main()
{
    char s1[MAXLINE+1], s2[MAXLINE+1];
    int n1, n2;

    scanf(" %[^,],%i ,%i , %[^\n]",s1,&n1,&n2,s2);
    printf ("%s,%d,%d,%s\n", s1,n1,n2,s2);
    return 0;
}

/*
INPUT
key 1,0x20,10,value one

OUTPUT
key 1,32,10,value one
*/

/* End of File */