- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Help with getopt.h
Operating System - Linux
1752802
Members
5400
Online
108789
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
тАО06-13-2001 06:28 PM
тАО06-13-2001 06:28 PM
Been writing a program for a while, and seem to be having a bit of difficulty with usting the standard argument processor "getopt.h".
It works fine for regular arguments, but I can not seem to cast the string to an integer for a arg with option.
What is getopt.h returning in optarg?
case 'l':
password_length = (int)optarg ;
break;
simply returns junk, and no matter which type I have tried to cast fails...
Logic problem?
Thanks in advance!
Shannon
It works fine for regular arguments, but I can not seem to cast the string to an integer for a arg with option.
What is getopt.h returning in optarg?
case 'l':
password_length = (int)optarg ;
break;
simply returns junk, and no matter which type I have tried to cast fails...
Logic problem?
Thanks in advance!
Shannon
Microsoft. When do you want a virus today?
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-13-2001 09:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2001 03:43 AM
тАО06-14-2001 03:43 AM
Re: Help with getopt.h
Darn good wild guess!
Where did you get that
atoi(optarg)
I'll asume it's an array?
I dug through man pages, and my C book...the C book was using strcat and strcopy to a buffer, and using the buffer... and strlen and such... yours was pretty easy!
Thanks!
Shannon
Where did you get that
atoi(optarg)
I'll asume it's an array?
I dug through man pages, and my C book...the C book was using strcat and strcopy to a buffer, and using the buffer... and strlen and such... yours was pretty easy!
Thanks!
Shannon
Microsoft. When do you want a virus today?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2001 04:06 AM
тАО06-14-2001 04:06 AM
Re: Help with getopt.h
Shannon,
Per the man page for getopt(2), "optarg" is defined as an "extern char *". So in order to convert this to an integer, you need to use the atoi() function from
Per the man page for getopt(2), "optarg" is defined as an "extern char *". So in order to convert this to an integer, you need to use the atoi() function from
I think, therefore I am... I think!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP