Yes, agree, very strange. It's the first time I ever checked for an error after using realpath(), and it was purely by accident; I was adding code to check for fopen() and fclose() for errors, then...
Type: Posts; User: Andy_PBC
Yes, agree, very strange. It's the first time I ever checked for an error after using realpath(), and it was purely by accident; I was adding code to check for fopen() and fclose() for errors, then...
@algorism: file says "/home/andy/temp/a: empty".
It's a zero-byte file created with touch.
This is my current solution:
char real_path[PATH_MAX];
real_path[0] = '\0';
cur_file is an argument from the command line. I've used the absolute path for testing, though it works the same way if I gave it the basename (a) for an argument - the path still resolves to the...
You set up two arrays, the first one is unchanged. Search that, add each char to the second array, unless it's a comment (or /* or */). If it encounters the sequence */\n, don't add any of those...
If you need it in PDF format, maybe searching Google, or this site, for C tutorial will give you the info you're looking for. Digital format both ways.
This suggestion is on page 34 of The C Programming Language (ANSI C Version), 2nd Ed. by Brian W. Kernighan & Dennis M. Ritchie.
I just did this last week, shortly after purchasing the book....
On some systems, "." might be included in the path, "." being your present working directory.
You can append it to your current search path by using
export PATH=$PATH:.
And insert it into...