🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.lenguajes.c++
Article #16205

Re: Problem accessing global structure in Borland C.

#16205
From: Juan Conejero Gil
Date: Sun, 08 Dec 1996 00:00
42 lines
1606 bytes
Matthew wrote:
 
> I am having a problem accessing a global structure from within a
> function in Borland C.
> Microsoft says " object->data "  I tried " object.data " but does not
> recognize global structure gives: " structure must be on left side of
> . or .*  " compiling error. [...]

The . operator accesses members of a class via a reference to object; 
the -> operator does the same for a pointer to object. For example, 
having

	class X
	{
	public:
		// ...
		int a;
	};

and

	X x;
	X *xptr = &x;

we can access data member X::a through both

	x.a      // access via a reference to X
	xptr->a  // access via a pointer to X

with the same results. What you're experiencing is probably due to a 
mispelling of variable names or, more likely, to the fact that you're 
using the '.' operator with a pointer. Check your declarations.

Hope this helps, but, how about trying comp.lang.c and comp.lang.c++?

-- 

// ******************************
// Juan Conejero Gil, AVA/SKYCAD
// mailto:skycad@ctv.es
// ******************************
Technical Details
Message-ID: <32AB45B0.1A7E@ctv.es>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <32a9667b.30730372@news.interlog.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f53ec,b925eeb9f467a364,start
X-Google-Attributes: gidf53ec,public
From: Juan Conejero Gil <skycad@ctv.es>
Subject: Re: Problem accessing global structure in Borland C.
Date: 1996/12/08
Message-ID: <32AB45B0.1A7E@ctv.es>
X-Deja-AN: 203285191
references: <32a9667b.30730372@news.interlog.com>
content-type: text/plain; charset=us-ascii
organization: AVA/SKYCAD
mime-version: 1.0
newsgroups: es.comp.lenguajes.c++
x-mailer: Mozilla 2.01Gold (Win95; I)