473,382 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to fix error: "request for member which is of non-class type"?

19
Hello,

I am getting the following error

25 C:\Dev-Cpp\main.cpp request for member `no' in `one', which is of non-class type `box[12]'


in the code

Expand|Select|Wrap|Line Numbers
  1. while (!myfile.eof())
  2.    {
  3.  
  4.    for(int i=0;i<12;i++)
  5.    {              
  6.     myfile>>one.no[i];           
  7.    }
  8.  
  9.    }
where 'one' is an object of struct type 'box' and 'no' is the variable inside the struct.

The above bit of code is just the simplified version of my complete code but basically I declared an array of struct type 'box' (size=12) , named it 'one', and am currently reading some numbers from a file into the variable 'no' of the struct.

I would be grateful if someone could let me know the source of the error. Thanks.
Feb 7 '11 #1

✓ answered by newb16

this
.... here 'one' is an object of struct type 'box'
and this...
I declared an array of struct type 'box' (size=12) , named it 'one', ...
are different things. The first one has the member 'no' that can be accessed as one.no ; the second is an array and has to be accessed like
one[1].no

2 30218
newb16
687 512MB
this
.... here 'one' is an object of struct type 'box'
and this...
I declared an array of struct type 'box' (size=12) , named it 'one', ...
are different things. The first one has the member 'no' that can be accessed as one.no ; the second is an array and has to be accessed like
one[1].no
Feb 7 '11 #2
kino
19
Oh! Thanks a lot! :)
Feb 7 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
1
by: Dorte | last post by:
Hi, My ASP.NET application calls a web service (in the same project) that queries a SQL server by using a data adapter to fill a dataset. The dataadapter may fill more than one dataset to build...
5
by: Archana | last post by:
Hi all, I am having application where i am downloading xml content using webrequest. my code is as below HttpWebRequest lWebRequest = (HttpWebRequest) WebRequest.Create(URL); HttpWebResponse...
1
by: jonny | last post by:
Went from using Visual Web Develop express to Visual Studio 2005 and getting error when trying to open project. Error message: "One or more projects in the solution could not be loaded for the...
2
by: sony.m.2007 | last post by:
Hi, When i try to set a value for a session variable I'm getting a object refence not set error I tried two methods as below HttpContext.Current.Session.Add("AppStartTime", DateTime.Now);...
0
by: =?Utf-8?B?UmF2aQ==?= | last post by:
Hi, I have WCF service and integrated with STS (WS-Federation). The Service exposes 5 endpoints Win, UNT and Federated Windows, Federated UNT and Mex endpoint. My STS Service exposes 3 endpoints...
4
by: sumit kale | last post by:
Hi, Can somebody help me resolve my problem ? I am getting error when calculating total using unbound textfiled in subform. I have a main form called purchase_register_master and a subform...
12
by: tvnaidu | last post by:
Trying to mount windows folder on Linux machine, getting this error. I have a folder called "CheckIn" on windows, I made that folder as Network sharing. ON lInux, I tried to access that folder by...
2
by: bandy | last post by:
Hi there sorry If I posted this thread under wrong head. When I am trying to run my site I am getting error as Internal Server Error, but when I refresh page , i get result properly. I don't...
6
by: gonella123 | last post by:
I am getting #Error while generating report, after converting the database from 2003 to 2007. The "#Error" when run the report. On this you have report elements use nested if-statements as...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.