Hi all,
I am using mmap to obtain some space(mapped anonymously) and am giving the address of the assigned space to a struct pointer. Then I want to access a member of the struct that the pointer points to. The code is:
//----begin
struct foo{
int test;
}foo;
struct foo one,*one_ptr;
one_ptr=mmap(NU LL,sizeof(one), PROT_READ|PROT_ WRITE,MAP_ANON,-1,0);
*one_ptr = one;...
User Profile
Collapse
-
Using mmap to assign space for a struct
-
Thanx gpraghuram,
Well, the problem was that I was trying to access retn_name in iter but lo and behold iter is a pointer and it doesn't have retn_name. What iter points to has the function so I changed the iter in line 241 to (*iter) -> retn_name and everything is fine. By fine I mean it compiles, it still doesn't do what I want it to.
Anyway, thanx to everyone for helping sp. gpraghuram.... -
forgot to mention:
line 340 condition = srch_list(listS Li, name_stq);//which calls the function
~code~
template <class type>
string srch_list(std:: list <type> &list_name, std::string srch_name)
{
string condition;
typename list<type>::con st_iterator iter;
for(iter = list_name.begin (); iter != list_name.end() ; iter++)
{
linen 241 if (iter->retn_name()...Leave a comment:
-
I changed the above snippet of code to
template <class type>
string srch_list(std:: list <type> &list_name, std::string srch_name)
{
string condition;
typename list<type>::con st_iterator iter;
for(iter = list_name.begin (); iter != list_name.end() ; iter++)
{
if (iter->retn_name() == srch_name)
condition = "true";
}
return...Leave a comment:
-
I changed the iterator to
template <class type> string srch_list(list <type> &list_name, std::string srch_name)
{
string condition;
typename list<type>::con st_iterator iter;
for(iter = (*list_name).be gin(); iter != (*list_name).en d(); iter++)
{
if ((*list_name)->retn_name() == srch_name)
condition = "true";
}
return condition;...Leave a comment:
-
iterator problem
Hi everyone,
I am a newbie to C++ programming and am running into iterator problems..here are the snippets and the error:
//First, I have a template class called SimpleList that provides linked list functionality with functions like push, pop etc..The idea is to create stack, queues of diff. types (like char, int etc.)
~~bunch of code in between~
//function to search a list for a particular...
No activity results to display
Show More
Leave a comment: