www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/08/21:13:47

From: lsantil AT calstatela DOT edu
Date: Mon, 8 Jun 1998 18:12:23 -0700 (PDT)
Message-Id: <199806090112.SAA05038@neptune.calstatela.edu>
To: djgpp AT delorie DOT com
Subject: Problem w/cin & structs

Hi.

I'm having a problem w/DJGPP's cin.getline w/a struct

Ok here's my code snippet
#include <iostream.h>

struct thing
{
   unsigned char line[81];
   int count;
};

void chng(thing &x);

void main(void)
{
   thing *y;
   chng(y);
}

// gxx complains here that there is no matching function call
//    thing::thing(...then it gives some possible candidates
//    for functions calls w/ & w/o variables
void chng(thing &x)
{
   cin.getline(x.line, 81);
   // This is suppose to be an ANSI call according to my text book
   // (whoopee this a part of my final that's due tomorrow)
   // But gxx complains that the correct call should be
   //    cin.getline(char *, int, char);
   //    even though iostream.h says that the last char is
   //    char n = '\n'
   // I have never that type of function or method declaration
}

Please help me!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019