From: nbehzad@ee.ualberta.ca (Nader Behzad)
Subject: Segmentation Violation
Date: 1996/11/06 [thread overview]
Message-ID: <55qgbj$tdi@pulp.ucs.ualberta.ca> (raw)
Hi all,
Could anyone tell me if I am doing something wrong here or is it
the compiler:
char *tempstring;
tempstring = (char *)Malloc(256*sizeof(char));
char_count = strlen(angle_file);
tempstring = strrchr(angle_file, '/');
if (tempstring != NULL) {
tempstring++;
}
i = (char_count - strlen(tempstring)); /* <-------- A */
strncpy(temp, angle_file, i);
temp[i] = '\0';
"tempstring" is NULL and this causes the program to crash at point A.
The strlen result for NULL should be 0 right??
I don't have this problem under SUN_OS or Solaris platforms.
Thank you,
Sincerely,
Nader
--
---------------------------------------------------------------------
| |
| Nader T. Behzad |
| e-mail: nbehzad@ee.ualberta.ca |
| WWW: http://www.ee.ualberta.ca/~nbehzad |
| |
|===================================================================|
| |
| "Whatever you do will be insignificant, but it is very |
| important that you do it." --Mahatma Gandhi |
| |
---------------------------------------------------------------------
next reply other threads:[~1996-11-06 5:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-11-06 5:00 Nader Behzad [this message]
1996-11-06 5:00 ` Segmentation Violation Ron Natalie
1996-11-06 5:00 ` Steve Strange USG
1996-11-06 5:00 ` Ron Natalie
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox