One more thing. This is a small thing I used to test how each index of argv[] was terminated and I found something interesting that I didn't know.
Code:
#include <stdio.h>
int main(int argc, char *argv[])
{
int i;
for ( i=0 ; i < 20; i++ )
printf("%c",argv[1][i]);
printf("\n");
return 0;
}
Just prints every character of the index of argv[i]. I tested it a couple times and here were my results.
Code:
ate@ncward:~/c$ gcc try.c -o try
nate@ncward:~/c$ try cow
cowCPLUS_INCLUDE_PA
nate@ncward:~/c$ try cower
cowerCPLUS_INCLUDE_
nate@ncward:~/c$ try dddddddddddddddd
ddddddddddddddddCPL
nate@ncward:~/c$ try
Segmentation fault
nate@ncward:~/c$ try
Segmentation fault
nate@ncward:~/c$ try k
kCPLUS_INCLUDE_PATH
Im on Slack 10, 2.6.8 kernel and whatever gcc came with Slack 10. My question is simply that there is no way that this little function is portable ( maybe so I don't know ) but how are the indexs of argv[] terminated. I would just test until I hit the 'C' but I don't think this would be smart.