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

/prog/ challenge: Write a text editor

Name: Anonymous 2010-07-06 3:41

The best quality editor you can fit a post, not using external libraries. Only include default headers/imports/libraries.
Programs will be judged by their array of features, stability of operation and memory use.

Name: Anonymous 2010-07-07 8:13

If standard libs means "only functions present in libc":


#include <stdio.h>
#include <stdlib.h>

FILE *file;
char letter;

int main (int argc, char **argv)
{
  if (argc < 2)
  {
    fprintf (stderr, "D'oh! you didn't specify a file.\nUsage:%s <filename>", argv[0]);
    exit (1);
  }

  fopen (file, argv[1], "w");
  if (!file) {
    fprintf (stderr, "Could not open file %s\n");
    exit (1);
  }

  while (!feof(char = getchar()))
  {
     fprintf (file, "%c", letter);
  }

  return 0;
}


Or, the best editor for *n?x hackers:


/* cc besteditorever.c -obesteditorever */
#include <stdlib.h>

char *editor

int main (int argc, char *argv)
{
  editor = getenv ("EDITOR");
  return (system (editor));
}

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