File: stringIO.g

package info (click to toggle)
gap-io 4.9.3%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 776 kB
  • sloc: xml: 2,885; ansic: 2,709; makefile: 48; sh: 8
file content (35 lines) | stat: -rw-r--r-- 622 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# A few examples for IO to and from strings:
# Click this into a GAP:
LoadPackage("io");

# Reading from a string:
s := "A long string\nMax is here!\nHello world";
f := IO_WrapFD(-1,s,false);
IO_ReadLine(f);
f;
IO_Read(f,2);
f;
IO_ReadLines(f);
f;
IO_ReadLines(f);
IO_ReadUntilEOF(f);
IO_ReadLine(f);
IO_Close(f);

# Writing into a string:
b := "Anfang\n";
f2:= IO_WrapFD(-1,false,b);
IO_WriteLine(f2,"Max");
f2;
IO_GetWBuf(f2);
IO_Write(f2,"Hi there","\n","\c",1234,2/3,"\n");
f2;
IO_Write(f2,AsSet(SymmetricGroup(3)),"\n");
l := ["a","b","c"];
IO_WriteLines(f2,l);
IO_GetWBuf(f2);
f2;
IO_Close(f2);
f2;
IO_GetWBuf(f2);