Mail Archives: djgpp/1998/05/07/07:47:46
From: | Ville Lundberg <vlundber AT cc DOT hut DOT fi>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Segmentation fault in UNIX
|
Date: | Thu, 07 May 1998 14:37:41 +0300
|
Organization: | Helsinki University of Technology
|
Lines: | 28
|
Distribution: | inet
|
Message-ID: | <35519D05.18BA@cc.hut.fi>
|
NNTP-Posting-Host: | haapa.hut.fi
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Why does this simple piece of code cause a "Segmentation fault" in UNIX,
while it works just fine in DOS? The error occurs when the code hits the
getpass() function.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void main(void) {
char *lin, *pin;
do {
printf("Enter name and password:\n");
printf("Name:");
gets(lin);
} while(strcmp(lin, "")==NULL);
pin = getpass("Password:");
// And here's nothing more than opening a file and couple printf:s
}
=-----=
12) Pelimies ottaa napakympissa naäteimmäan tytoön.
Ville Lundberg vlundber AT cc DOT hut DOT fi www.hut.fi/~vlundber/pelimiehet
- Raw text -