It would be advisable to create these on the heap, rather than on the
stack (ie, using malloc() and free()). There is only so much space on
the stack, although 80 bytes should still fit fine.
char temp[20];
char localBuffer[60];
Here you should use getwd() instead of getenv, as PWD will not always
be set. It may well be why you are crashing, as you're not testing
for errors!
buffer = getenv ("PWD");
When printing debugging statements, always print to stderr, as stderr
is unbuffered, and will be printed immediately. So use fprintf
( stderr, ...)
If you don't, you can get a wrong impression of where a program is
crashing, if you go by the printf output.
Here you're assuming. You should use x-man-page://perror
in_file = fopen(buffer,"rt");
if (in_file==NULL)
{
You should use %19s (temp is 20 characters, so that's 19 characters
and the terminating nil) here, and fnscanf, otherwise you can
overflow the buffer, and crash.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden