- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- getuid() and C Program
Operating System - HP-UX
1820879
Members
5129
Online
109628
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
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-2002 12:27 AM
тАО06-13-2002 12:27 AM
I am having great difficulty in writing the following C program,..
main()
{
int curruid;
char commandline[1024];
curruid=getuid();
strcat(commandline, "/usr/local/bin/script1.sh ");
strcat(commandline, curruid);
system(commandline);
}
This program is designed to get the current uid of the person running the program and pass it to the Shell script for validation. However, C will not permit me to convert the integer value of getuid() to a string to concatenate to the command line. I have tried various combinations and all end up using the number passed as an ASCII value rather than its actual value.
Anyone know of any methods of converting this?
Thanks, Ian Dennison
main()
{
int curruid;
char commandline[1024];
curruid=getuid();
strcat(commandline, "/usr/local/bin/script1.sh ");
strcat(commandline, curruid);
system(commandline);
}
This program is designed to get the current uid of the person running the program and pass it to the Shell script for validation. However, C will not permit me to convert the integer value of getuid() to a string to concatenate to the command line. I have tried various combinations and all end up using the number passed as an ASCII value rather than its actual value.
Anyone know of any methods of converting this?
Thanks, Ian Dennison
Building a dumber user
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-13-2002 12:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-13-2002 12:42 AM
тАО06-13-2002 12:42 AM
Re: getuid() and C Program
Thanks Rik, magical answer!
Building a dumber user
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.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP