Dear GAP-Forum,
At first glance, the new features concernig Input-Output Streams seems
very interesting. Although trying the examples in the documentation I
encounter some problems. I wrote a very simple and small C-program that
reverses strings as in the example:
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
int main(void) { int size = 0; char* s = (char*) malloc(sizeof(char)); char c; while((c=getchar()) != '\n') { s = (char*) realloc(s,(++size)*sizeof(char)); s[size-1] = c; } s[size] = '\0'; while(size--) printf("%c",s[size]); printf("%c",'\n'); return 0; } The binary is in the directory ~/prog/ en works fine. It uses of course stdin and stdout. So I execute the following commands in GAP, with the following output: GAP4, Version: 4r2 fix6 of 26-January-2001, i686-pc-linux-gnu-gcc Components: small, small2, small3, small4, small5, small6, small7, small8, id2, id3, id4, id5, id6, trans, prim, tbl, tom installed. gap> d := Directory("./prog/"); dir("./prog/") gap> f := Filename(d,"rev"); "./prog/rev" gap> s := InputOutputLocalProcess(d,f,[]); < input/output stream to rev > gap> WriteLine(s,"The cat sat on the mat\n"); Child Process 2388 has stopped or died, status 256 at ret := WRITE_IOSTREAM( stream![1], text, - Length( text ) );
This is the output. What can be the problem? Are there specific conditions
for the external binaries to work with the mechanisms in GAP?
Jan De Beule
---------------------------------------------------------------------------- Jan De Beule jdebeule@cage.rug.ac.be Vakgroep Zuivere Wiskunde Jan.DeBeule@rug.ac.be Galglaan 2, B 9000 Gent (Belgium) http://cage.rug.ac.be/~jdebeule ----------------------------------------------------------------------------