I tried to compile that with vc++ 2008 Express on MS-Windows and got the following error. Maybe that is why your program seg faults, because there were compile errors that you failed to fix
1>c:\dvlp\test1\test1\test1.cpp(52) : error C2065: 'files' : undeclared identifier
1>c:\dvlp\test1\test1\test1.cpp(53) : error C2065: 'files' : undeclared identifier
[edit]see post #6, which answered that problem a 6 days ago ago![/edit]
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
> string home(getenv("HOME"));
Does this actually return a true path - one that starts with / ?
Because I see lots of ~ flying about, and programs do NOT expand ~ automagically for you (that's what the shell does).
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
> string home(getenv("HOME"));
Also, it will crash when getenv() returns NULL; Better to make that two statements so that you can check for NULL.
>>"a:p:f:rlhc"
I had to add another colon after the r in order to make that work right. "a:p:f:r:lhc"
Why are you mixing FILE and fstream in the same program? Since this is a c++ program you should replace FILE with fstream.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343