Name:
Over 1000 Thread
2009-11-23 22:27
Over 1000
This thread has over 1000 replies.
You can't reply anymore.
Name:
Anonymous
2009-11-24 8:08
#include <stdio.h>
#include <wchar.h>
#include <string.h>
#include <locale.h>
#include <errno.h>
FILE* fffffffibonacci_butt_sort(FILE *s, size_t n)
{
size_t i = 0;
wint_t tags[] = {L'u', L'o'};
wint_t c = WEOF;
for(i = 0; i < n; ++i)
{
if((c = fgetwc(s)) == L'n')
{
fputwc(L'n', stdout);
return s;
}
else if(iswspace(c))
{
fputwc(c, stdout);
}
else if(c != WEOF)
{
wprintf(L"[%lc]%lc[/%lc]", tags[(i%2)], c, tags[(i%2)]);
}
else
{
return NULL;
}
}
return s;
}
int main()
{
if(!setlocale(LC_CTYPE, NULL))
{
fwprintf(stderr, L"Warning: Locale not specified.n");
}
const size_t BUFFA_SIZE = 4096;
wint_t c = WEOF;
fputws(L"", stdout);
while((c = fgetwc(stdin)) != WEOF)
{
if(ungetwc(c, stdin) == WEOF)
{
fputws(L"Failed to ungetwc.n", stderr);
break;
}
if(!fffffffibonacci_butt_sort(stdin, BUFFA_SIZE))
{
break;
}
}
fputws(L"n", stdout);
if(ferror(stdin))
{
perror(strerror(errno));
fputws(L"Input error occured. Output probably corrupted."
"Shit fucking sucks.n", stderr);
}
return 0;
}
Name:
Over 1000 Thread
2009-11-24 8:08
Over 1000
This thread has over 1000 replies.
You can't reply anymore.