![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with msgget() | Ashwini | High Level Programming | 2 | 09-14-2006 09:13 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#8
|
|||
|
|||
|
I dont see any error in the code pasted above, though I still think the error is somewhere else! Why dont you paste the whole program, we'll hopefully solve the problem.
|
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
ok,this is my program in the form
/* this is main entry */
main() { char sErrMsg[100]; EXEC SQL BEGIN DECLARE SECTION; char sWorkDB[20]; EXEC SQL END DECLARE SECTION; /* control signal */ signal( SIGCHLD,SIG_IGN ); signal( SIGKILL,exitfunc ); signal( SIGQUIT,exitfunc ); signal( SIGPIPE,SIG_IGN ); signal( SIGTRAP,sigerr ); /* to build a queue */ msgid__=openMsg(2101); if( msgid__ <=0 ){ fprintf( stderr,"%s\n",strerror(errno) ); fprintf( stderr,"create queue error!!\n" ); exit(-1); } ....... } /* this is the function body about openMsg */ int openMsg( key_t k ) { int iRtn; key_t key; char sFilePath[200]; if( k == 0 ){ /* if k is zero , get key by a file */ sprintf( sFilePath,"%s/MSG_ERR_ID",getenv("CNF_PATH") ); key=ftok(sFilePath,'@'); if( key < 0 ){ errorlog("%s.[%s,%d]",strerror(errno),__FILE__,__LINE__); return -1; } } else{ key = k; } iRtn=msgget(key,IPC_CREAT|IPC_EXCL|0666); if( iRtn<=0){ errorlog("%s.[%s,%d]",strerror(errno),__FILE__,__LINE__); } end: return iRtn; } |
|
#10
|
|||
|
|||
|
i have found the problem
just modified the main entry program.main()
{ char sErrMsg[100]; EXEC SQL BEGIN DECLARE SECTION; char sWorkDB[20]; EXEC SQL END DECLARE SECTION; signal( SIGCHLD,SIG_IGN ); signal( SIGKILL,exitfunc ); signal( SIGQUIT,exitfunc ); signal( SIGPIPE,SIG_IGN ); signal( SIGTRAP,sigerr ); msgid__=openMsg(SYSMSG_ID); /*if( msgid__ <=0 ){ this is the trouble*/ if(msgid__<0){ fprintf( stderr,"%s\n",strerror(errno) ); fprintf( stderr,"create queue error!\n" ); exit(-1); } Thank for your advices deeply. |
|||
| Google The UNIX and Linux Forums |