home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!gatech!darwin.sura.net!jvnc.net!primerd.prime.com!boddu!alvin
- From: alvin@boddu.prime.com (Alvin)
- Subject: Help! Why this small program core dump ?
- Message-ID: <1992Jul31.160542@boddu.Prime.COM>
- Sender: usenet@primerd.prime.com (Usenet)
- Organization: Prime Computer R&D
- Date: Fri, 31 Jul 1992 20:14:33 GMT
- Lines: 47
-
- Hi,
-
- I am pretty new to XWindow. I have the following codes that core dumped.
- I cannot find what is wrong ! Before it calls XtInitialize, it just go into
- a loop which read a line from the file and put it into a char pointer array.
- It core dumps in XtInitialize. Here is the code. Any help is appreciated !
-
- -Alvin
-
- ------------------------------------------------------------------------
- #include <stdio.h>
- #include <Xm/Xm.h>
- #define MAXLINES 10
-
-
- char *account[MAXLINES];
- char temp[20];
-
- main(argc, argv)
- int argc;
- char *argv[];
- {
- XtAppContext app;
- Widget toplevel;
- int i;
- int len;
- int noentry;
- FILE *account_file;
- account_file = fopen("account", "r");
- i = 0;
- while(fgets(temp, 21, account_file) != NULL) {
- len = strlen(temp);
- account[i] = (char *)calloc(len,1);
- strcpy(account[i], temp);
- i++;
- }
- fclose(account_file);
- noentry = i;
-
- toplevel = XtVaAppInitialize(&app, "Major", NULL, 0, &argc, argv,
- NULL, NULL);
- }
-
- Feng-shun (Alvin) Chang |
- Software Support Analyst | We need more "love" than "hate"
- Prime Computers, Inc. |
- Email : ALVIN@CSSS-A.PRIME.COM |
-