#include #include #include // socks.graph.c - lrb - 1/6,7/23 void asterisk( int y ) { while (y) { putchar('*'); y = y - 1; } } int main() { printf("\nsocks.graph - 1/17/23 - lrb\n\n"); char string[1000]; FILE *fp; fp = fopen("graph.inp.txt","r"); if (fp==NULL) { printf("\ncan't open graph.inp.txt\n"); exit(1); }; int i=0,j; fgets (string, 1000, fp); char *token[80]; char *tok[3]; token[0] = strtok(string," "); // first call returns pointer // to first part of user_input // separated by delim while (token[i] != NULL) { i++; token[i] = strtok(NULL," "); // every call with NULL uses // saved user_input value and // returns next substring } for (j=0; j<=i-1; j++) { tok[0] = strtok(token[j],","); int p=0; while (tok[p] != NULL) { if (p==0) printf("%d ",atoi(tok[0])); if (p==1) { asterisk(atoi(tok[1])); printf(" (%d)",atoi(tok[1])); printf("\n"); } p++; tok[p] = strtok(NULL, ","); // every call with NULL uses // saved user_input value and // returns next substring } } exit(0); }