- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- error while running a code
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
04-04-2005 12:17 AM
04-04-2005 12:17 AM
error while running a code
i wrote the below code. it compiled fine, when i ran it exited eith the message
"Memory fault(coredump)"
#include
int main()
{
char *str;
int dec=0,sign=0;
int ndig=0;
ndig=8;
printf("before");
str=_ldecvt(234.9,ndig,&dec,&sign);
printf("%d %d",dec,sign);
return 0;
}
what could be the problem.
please help me.
- Tags:
- SIGSEGV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2005 12:23 AM
04-04-2005 12:23 AM
Re: error while running a code
You are compiling with what?
What compile and possible load options did you use?
With gcc I got it to compile and run (executed a.out) with these results:
before3 0
with just a plain cc I got errors:
cc: "txt.c", line 9: error 1718: Types are not assignment-compatible.
cc: "txt.c", line 9: warning 563: Argument #1 is not the correct type.
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2005 01:47 AM
04-04-2005 01:47 AM
Re: error while running a code
#include
int main()
{
char *str;
int dec=0,sign=0;
int ndig=0;
long_double value;
ndig=8;
value=strtold("234.9", NULL);
printf("before");
str=_ldfcvt(value, ndig, &dec, &sign);
printf("%d %d",dec,sign);
return 0;
}
But you really ought to get a proper compiler!
- Tags:
- strtold
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2005 04:41 AM
04-05-2005 04:41 AM
Re: error while running a code
I could not get the _ldecvt() library functions to work either. In the HP C/HP-UX reference manual Version A.06.00/A.05.60 page 205 it states that Functons names beginning with a underscore (_) are reserved for library use; you should not speify identifiers that begin with an underscore.
I was able to make your code work using "evct()" which appears to be an equilvant function.
#include
int main()
{
char *str;
int dec=0,sign=0;
int ndig=0;
ndig=8;
long double value=234.9;
(void) printf("before\n");
str=ecvt(value,ndig,&dec,&sign);
(void) printf("%s\n",str);
(void) printf("%d %d\n",dec,sign);
return 0;
}
Hope this helps.
Rory
- Tags:
- ecvt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2005 05:08 PM
04-05-2005 05:08 PM
Re: error while running a code
Thanks for your reply.
The program is running fine.
Regards,
Arun