- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- map->insert() it killing my procees the program ju...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2007 12:05 AM
07-12-2007 12:05 AM
map->insert() it killing my procees the program just aborts
typedef std::map
typedef std::pair
void streamFileXML(const char *filename,char * tag_oracle,mapamemoria *mapa_colunas)
try
{
// mapa_colunas->insert(Map_Str_Pair("sdfsdfds","uiyuiyui"));
(*mapa_colunas)["elemento"]="ola";
//(char *)namexml_temp;
(*mapa_colunas)["texto"]="ole";
//(char *)oracle_value;
}
catch(exception e)
{
sprintf(sstring, "excepcao -- >%s",e.what());
log_message(LOG_FILE,sstring);
}
this the makefile
# Fichero de construcción del proyecto Schengen
DIR_ACTUAL=$(shell echo $(PWD))
INCLUDE=.,$(DIR_ACTUAL)/common
OBJS=
CCC=aCC
ICLIBHOME=/usr/local/lib/hpux32
ICLIBPATH=-L$(ICLIBHOME)
CCLIB=$(ICLIBPATH) -lxml2 -lz
INCLUDES=/usr/local/include/libxml2
EXE=daemon
all: exe
daemon.o: daemon.cc
$(CCC) -c daemon.cc -I$(INCLUDES)
cp *.o ../../obj
rm *.o
exe: daemon.o
$(CCC) -o $(EXE) ../../obj/daemon.o $(CCLIB)
cp $(EXE) ../../bin
rm $(EXE)
.PHONY: clean
clean:
-rm ../obj/*.o
- Tags:
- containers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2007 12:07 AM
07-12-2007 12:07 AM
Re: map->insert() it killing my procees the program just aborts
so i have tried this
(*mapa_colunas)["elemento"]="ola";
//(char *)namexml_temp;
(*mapa_colunas)["texto"]="ole";
still does not work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2007 01:45 AM
07-12-2007 01:45 AM
Re: map->insert() it killing my procees the program just aborts
void streamFileXML(const char *filename,char * tag_oracle,mapamemoria &mapa_colunas)
try
{
mapa_colunas.insert(Map_Str_Pair((char *)namexml_temp,(char *)oracle_value));
}
catch(exception e)
{
sprintf(sstring, "excepcao -- >%s",e.what());
log_message(LOG_FILE,sstring);
}
this works BUT:
i have this struct with a map inside
typedef struct dataestrutura {
mapamemoria mapa_mem;
} dataestrutura;
i have this pointer to it in the function
dataestrutura *data_ptr;
mapamemoria xmlelementos_oracle_bd;
m_shmid=shmid;
/* attach to the segment to get a pointer to it: */
data_ptr = (dataestrutura *)shmat(shmid,0, 0);
if (data_ptr == (dataestrutura *)(-1))
{
perror("shmat");
exit(1);
}
i am going to fill up the map :
streamFileXML(CONFIG_FILE_NAME,ORACLE_BD_TAG, xmlelementos_oracle_bd);
then i have to fill up the map in memory segment :
WELL this it is not working , compiles but on execution kills the program -- abort
data_ptr->mapa_mem=xmlelementos_oracle_bd;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2007 05:32 PM - edited 09-25-2011 03:17 PM
07-12-2007 05:32 PM - edited 09-25-2011 03:17 PM
Re: map->insert() it killing my process, the program just aborts
If your process aborts, you need to show a stack trace.
typedef std::map mapamemoria;
typedef std::pair Map_Str_Pair;
The last typedef is illegal. You must NOT define the pair used in a map. You must use STL typedefs to compute it:
typedef mapamemoria::value_type Map_Str_Pair;
Is string the same as std::string?
>the insert() compiled successfully
I don't see how with the wrong Map_Str_Pair.
// attach to the segment to get a pointer to it:
data_ptr = (dataestrutura*)shmat(shmid,0, 0);
Don't even think of doing this. This won't work! You'll have the same problems as in your:
(Where I mention using a "STL allocator".)
>then I have to fill up the map in memory segment: WELL this it is not working, compiles but on execution kills the program
data_ptr->mapa_mem=xmlelementos_oracle_bd;
I'm not sure why this won't work. But it is useless. You can't have a shared pointer to private data. Only the original process can use that pointer to that map.
A stack trace would be helpful here.