Even if you have to implement it yourself:
Code:
#include <string.h>
char *strrev(char *str)
{
char *p1, *p2;
if (! str || ! *str)
return str;
for (p1 = str, p2 = str + strlen(str) - 1; p2 > p1; ++p1, --p2)
{
*p1 ^= *p2;
*p2 ^= *p1;
*p1 ^= *p2;
}
return str;
}
int main(int argc, char *argv[])
{
char *inputString = "Hello World!";
char workBuf[5];
int curPos = 0;
int lastPos = curPos;
bool bDone = false;
while(!bDone)
{
if( strlen(inputString) <= curPos+4)
{
bDone = true;
}
memset(workBuf, 0, 5);
strncpy(workBuf, inputString+curPos, 4);
printf("%s", strrev(workBuf));
curPos += 4;
if(curPos > strlen(inputString))
{
curPos = strlen(inputString) - lastPos;
}
else
{
lastPos = curPos;
}
}
printf("\nEnd Processing.\n");
return 0;
}
Note this is a fast hack while I am doing other things so don't blame me if it eats your cat or something ^__^