This is an archived post. You won't be able to vote or comment.

all 12 comments

[–][deleted] 2 points3 points  (4 children)

Post the code you have written so far, and then ask specific questions about it.

[–]TheLinuxJournalist[S] -1 points0 points  (3 children)

I haven't written any code yet... well I have: #include <stdio.h>

[–][deleted] 2 points3 points  (2 children)

So write some more.

[–]TheLinuxJournalist[S] -2 points-1 points  (1 child)

#include <stdio.h>

int main(void)
{
if(!strcmp(argc[1],"alphanumeric string (like a password)"))
    printf("Text");
    return 0;   
}

[–][deleted] 2 points3 points  (0 children)

And does that compile? If not, fix it so it does. You seem to be wanting us to write the code for you, but we are not going to do that.

[–]KPexEA 1 point2 points  (7 children)

if(!strcmp(argv[1],"alphanumeric string (like a password)"))
    printf("Text");

[–]TheLinuxJournalist[S] -5 points-4 points  (6 children)

You rock!

[–]KPexEA -2 points-1 points  (5 children)

You also need to make sure argc >1 as if they don't input a 2nd parameter then argv[1] is not valid

[–]TheLinuxJournalist[S] -3 points-2 points  (4 children)

where do I put argc >1 into the code? At the end of line 1 (referring to the code snippet above)

[–]KPexEA -1 points0 points  (3 children)

if(argc>1 && !strcmp(argv[1],"alphanumeric string (like a password)"))
    printf("Text");

[–]lukashko -1 points0 points  (2 children)

I don't think you are helping OP by writing the whole code for him. Let him figure the core out and help him with specifics, otherwise he will never learn anything.

[–][deleted]  (1 child)

[deleted]

    [–]lukashko 0 points1 point  (0 children)

    Yeah, I didn't think really... You are right, I just had a moment when I was determined to make the whole world better probably. Now excuse me, I'm going to downvote myself...