Mail Archives: djgpp/1992/06/15/07:09:37
The following changes have to be made in the sample-Program sort.cc
to compile without warnings (changes 1-3: unsigned char -> char)
and not to crash with Segmentation violation when no filename argument
is given (i.e. standard input is to be sorted).
(at least this is true on my AT 486/33 clone).
It's not that much important, but it is the first time I used the compiler
and it was the first program I tried to compile and the result was a crash,
which was a bit disencouraging.
*** sort.cc Sun Jun 14 12:27:30 1992
--- sortold.cc Wed Mar 20 21:51:18 1991
***************
*** 6,11 ****
ENTRY *before, *after;
ENTRY *same;
! char *line;
! char *sort_ptr;
ENTRY();
~ENTRY();
--- 6,11 ----
ENTRY *before, *after;
ENTRY *same;
! unsigned char *line;
! unsigned char *sort_ptr;
ENTRY();
~ENTRY();
***************
*** 32,36 ****
ENTRY *eroot=0;
! void read_one_data(char *s)
{
ENTRY *e, **eptr;
--- 32,36 ----
ENTRY *eroot=0;
! void read_one_data(unsigned char *s)
{
ENTRY *e, **eptr;
***************
*** 78,82 ****
void read_data(FILE *f)
{
! char buf[1024];
while (fgets(buf, 1024, f) != NULL)
{
--- 78,82 ----
void read_data(FILE *f)
{
! unsigned char buf[1024];
while (fgets(buf, 1024, f) != NULL)
{
***************
*** 105,109 ****
{
int i;
! while (argc > 1)
{
if (argv[1][0] == '+')
--- 105,109 ----
{
int i;
! while (1)
{
if (argv[1][0] == '+')
- Raw text -