Operating System - OpenVMS
1752577 Members
4428 Online
108788 Solutions
New Discussion юеВ

Re: Password reading through C/C++ in OpenVMS

 
SOLVED
Go to solution
hem c reddy
Advisor

Password reading through C/C++ in OpenVMS

Hello,

Can anybody help me out how to read a password without echoing on the screen through C/C++ in OpenVMS?

Is there a substitute for temios.h or getpass()?

Thanks in advance,

Regards,
hem
12 REPLIES 12

Re: Password reading through C/C++ in OpenVMS

Hi,
take a look at OpenVMS runtime library function: smg$read_string with option TRM$M_TM_NOECHO.

Cheers,
Sergejus
Galen Tackett
Valued Contributor
Solution

Re: Password reading through C/C++ in OpenVMS

Hem,

If all you want to do is to read without echoing, see my response to your other topic "Password reading in OpenVMS."

It's a lot simpler than using SMG$ (the screen management runtime library), though if you want to do fancier things like move the cursor around the screen, erase individual lines on the screen, etc., you'd want to check out SMG$ as Sergejus suggests.

Galen
hem c reddy
Advisor

Re: Password reading through C/C++ in OpenVMS

Hi Galen,

Thanks very much, it simply solved my problem.

Could you clarify this?

In that documentation I see "RNE" for read and no echo instead of "me". Can I use "PTA" too to clear the buffer along with "me"? If "me" is for "RNE" is there something similar for "PTA" too?

Is the following usuage correct? freopen("TT:","r",stdin,"rop=me,pta")

Thanks again,

Regards,
Reddy
hem c reddy
Advisor

Re: Password reading through C/C++ in OpenVMS

Just a couple of corrections ...

Mistakenly I read "rne" as "me". I regret for that and the usuage should read as
freopen("sys$input:","r",stdin,"rop=rne,pta");

Thanks,
Reddy
Galen Tackett
Valued Contributor

Re: Password reading through C/C++ in OpenVMS

Hem,

I'm pleased to hear that my suggestion worked for you.

Although I haven't tried it, "rop=rne,pta" looks like it should clear the typeahead buffer as well as turning off echo.

Galen
Craig A Berry
Honored Contributor

Re: Password reading through C/C++ in OpenVMS

hem c reddy
Advisor

Re: Password reading through C/C++ in OpenVMS

Hi All,

Thanks for your attention to the post.

Galen,

does your solution work for all type of terminals/consoles or it has any dependencies?

Regards,
Reddy
Jan van den Ende
Honored Contributor

Re: Password reading through C/C++ in OpenVMS

hem,

from your Forum Profile:


I have assigned points to 0 of 19 responses to my questions.


Maybe you can find some time to do some assigning?

http://forums1.itrc.hp.com/service/forums/helptips.do?#33

Mind, I do NOT say you necessarily need to give lots of points. It is fully up to _YOU_ to decide how many. If you consider an answer is not deserving any points, you can also assign 0 ( = zero ) points, and then that answer will no longer be counted as unassigned.
Consider, that every poster took at least the trouble of posting for you!

To easily find your streams with unassigned points, click your own name somewhere.
This will bring up your profile.
Near the bottom of that page, under the caption ├в My Question(s)├в you will find ├в questions or topics with unassigned points ├в Clicking that will give all, and only, your questions that still have unassigned postings.

Thanks on behalf of your Forum colleagues.

PS. ├в nothing personal in this. I try to post it to everyone with this kind of assignment ratio in this forum. If you have received a posting like this before ├в please do not take offence ├в none is intended!

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Galen Tackett
Valued Contributor

Re: Password reading through C/C++ in OpenVMS

Hem,

It should work for any VMS terminal device I can think of, probably including pseudo terminals (PTxx: devices) and the SYS$INPUT of batch and detached processes.

As I mentioned, though, it isn't portable to other operating systems. For portability, it would be better to hide it behind a jacket routine as Craig has done (see his previous response.)

I'm not certain that using SYS$QIOW would be quite as flexible as I don't know whether the function modifiers would be accepted by non-TT: type devices (e.g. batch input stream).

Happy New Year,

Galen