[ create a new paste ] login | about

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

C, pasted on Nov 19:
#include<stdio.h>
#include<string.h>
#define ALPHA "abcdefghijklmnopqrstuvwxy"

int main(void)
{

   char pd[1000];
   int charCount;
   int x;
   char packedString[1000];
   charCount = 0;
   printf("Enter a string: ");
   fget(pd, sizeof(pd), stdin);

   printf("%s/n", pd);

   for(x=0; x < sizeof(pd); x++)
   {
     pd[x] = tolower(pd[x]);
   }

   printf("%s/n", pd);


   *packedString = '\0';
   char* pStr = pd;

   while(*pStr != '\0')
   {
    charCount = strspn(pStr, ALPHA);
    pStr[charCount] = '\0';
    strncat(packedString, pStr, 1000-strlen(packedString));
    pStr += charCount +1;
    printf("%s\n", packedString);
   }
}


Output:
1
2
In function `main':
undefined reference to `fget'


Create a new paste based on this one


Comments: