Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Recursive programs

Name: Anonymous 2011-05-30 20:08

I decided to write a program that printed itself, and I couldn't.

I pose to you this challenge, /prog/

Name: Anonymous 2011-05-31 1:43

#include <stdio.h>
#include <string.h>

int main(void)
{
  FILE *prog = fopen("writemyself.c","r");
  char *buffer = malloc(sizeof(char) * 30);
  memset(buffer, '\0', sizeof(char) * 30);
  while (fscanf(prog,"%s", buffer))
  {
    fprintf(stderr, "%s", buffer);
    memset(buffer, '\0', sizeof(char) *30);
  }
  return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List