PLEX86  x86- Virtual Machine (VM) Program
 CVS  |  Mailing List  |  Download  |  Newsgroups

Thou shalt have no other gods before the ANSI C standard 1401


Your Ad Here

Your Ad Here

Thou shalt have no other gods before the ANSI C standard 1403
Trevor L. Jackson, III I don't know. The extra complexity from coding in a way that will work even on platforms where bytes are...

Hank Oredson

A slight modification of this should do it (it needs to open the output file after finishing the input reading). You will need ggets.c, which is available at:

* File freverse.c - testing ggets *

#include "ggets.h"

typedef struct node { struct node *next; char *ln; } node, *nodeptr;

* ======================= *-* reverse string in place *-* return length of string *sizet revstring(char *stg) { char *last, temp; sizet lgh;

lgh = strlen(stg); last = stg + lgh; * points to '-0' * temp = *stg; *stg++ = *last; *last = temp; } } return lgh; }* revstring *

* ======================= *-* reverse file *int main(void) { char *line; nodeptr root, temp; int lncount, chcount;

Thou shalt have no other gods before the ANSI C standard 1402
More like it doesn't look far enough ahead, which you sort of say in different words later on. fnewseek() fnewread() fnewwrite() fnewtell() etc. (Feel free to come up with a better name that...

fprintf(stderr, "Reversing stdin to stdout-n"); root = NULL; lncount = chcount = 0; while (0 == ggets(&line)) { if (NULL == (temp = malloc(sizeof *temp))) { fprintf(stderr, "Out of memory-n"); return EXITFAILURE; } chcount += revstring(line); lncount++; root = temp; }

while (root) { temp = root; free(temp); } fprintf(stderr, "%d chars in %d lines-n", chcount, lncount); return 0; }* main *-* END freverse.c - testing ggets *

-- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson



Your Ad Here

List | Previous | Next

Thou shalt have no other gods before the ANSI C standard 1402

Alt Folklore Computers from Newsgroups

The #1 Usenet Provider on the Internet

Thou shalt have no other gods before the ANSI C standard 1400