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
Discussions
Discussions
Forums
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
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
тАО03-24-2009 08:06 AM
тАО03-24-2009 08:06 AM
help in C
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 08:40 AM
тАО03-24-2009 08:40 AM
Re: help in C
$ cc x
$ link x
$ run x
hi
hi
$ type x.c
#include
main()
{
char foo[255];
gets( foo );
printf( foo );
return 0;
}
$
The above code runs and does exactly what you've asked for, but it's not particularly secure nor entirely reliable. The gets call has vulnerabilities.
I've posted a far larger example C program (that does this prompting, and a whole lot more) in the newuser code in the zip archive available available via:
http://64.223.189.234/node/1135
The OpenVMS C manuals and the OpenVMS programming concepts manuals (all of which are required reading here) are available at:
http://www.hp.com/go/openvms/doc
The C manuals and the Programming Concepts manual introduce you to the language and to programming C on OpenVMS.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 08:45 AM
тАО03-24-2009 08:45 AM
Re: help in C
I am sorry i think i explained it wrong, i dont want to input a string from command line but i want to be able to pass an argument to a procedure say x("test string")
and the program should print the string ?
thanks for help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 08:49 AM
тАО03-24-2009 08:49 AM
Re: help in C
#include
void main ()
{
while (putchar (getchar ()) != EOF)
{}
}
^Z
$ cc demo
$ link demo
$ run demo
the quick brown fox jumps over the lazy dog!
the quick brown fox jumps over the laxy dog!
^Z
Figuring out how to get rid of the y-umlaut at the end is left as an exercise.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 08:54 AM
тАО03-24-2009 08:54 AM
Re: help in C
SUNNY2$ type snmp.c
#include
#include
int main( char *msg)
{
int sts;
char *cmd = "mcr sys$system:tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.100.18.245 -v2c 1.3.6.1.6.3.1.1.4.1.0 \"D\" \"msg\"";
printf( " cmd: >%s<.\n", cmd);
sts = system( cmd);
printf( " sts = %%x%08x.\n", sts);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 09:02 AM
тАО03-24-2009 09:02 AM
Re: help in C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 09:04 AM
тАО03-24-2009 09:04 AM
Re: help in C
$ cc demo
$ link demo
$ run demo
Neither my nor Hoff's programs accepted input from the command line in that sense.
You say you want to "pass an argument to a procedure".
Do you mean like a function call? For example the printf function call:
printf ("test string\n");
Or you want to write a function that accepts a string argument and sends it to printf?
Or do you want to write a program that prints strings from the command line as in
$ demo "test string"
test string
?
In the latter case, refer to the DECC Language Reference Manual "Passing Arguments to the main Function", which is section 5.6.3 in the very old copy that I have.
You can find the DECC documentation in the usual places on the HP VMS documentation web site.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 09:18 AM
тАО03-24-2009 09:18 AM
Re: help in C
so from command prompt i should be able to do this
$sndsnmp :== $sys$login:snmp.exe
$sndsnmp "test msg"
$sndsnmp "another test"
run snmp.exe "test msg" and the prog should replace the 'msg' value in the program with "test msg" , do you know what iam saying ?
let me know otherwise i will explain further
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 09:34 AM
тАО03-24-2009 09:34 AM
Re: help in C
Probably your solution will include a statement something like this:
sprintf (cmd, "long string prefix %s", argv[1]);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2009 09:40 AM
тАО03-24-2009 09:40 AM
Re: help in C
let me explain in a better way , I think what i need is very simple .
this is my working program now :
#include
#include
int main()
{
int sts;
char *cmd = "mcr sys$system:tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.100.18.245 -v2c 1.3.6.1.6.3.1.1.4.1.0 \"D\" \"msg\"";
printf( " cmd: >%s<.\n", cmd);
sts = system( cmd);
printf( " sts = %%x%08x.\n", sts);
}
I run it like this :
SNDSNMP == "$SYS$LOGIN:SNMP.EXE"
SUNNY2$ sndsnmp
cmd: >mcr sys$system:tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.100.18.245 -v2c 1.3.6.1.6.3.1.1.4.1.0 "D" "msg"<.
sts = %x00000001.
you see above its constructing a command with hard coded "msg" .
i want to be able to do this
$sndsnmp "test msg"
and it should construct the command
cmd: >mcr sys$system:tcpip$snmp_trapsnd.exe 0.0 local 0 0 0 -h 10.100.18.245 -v2c 1.3.6.1.6.3.1.1.4.1.0 "D" "test msg"<.