![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reading a file and writing the file name to a param file. | thebeginer | UNIX for Advanced & Expert Users | 1 | 10-05-2007 05:38 PM |
| Reading file names from a file and executing the relative file from shell script | anushilrai | Shell Programming and Scripting | 4 | 03-10-2006 05:25 AM |
| Creating breadth traversal binary tree | slurpeyatari | Shell Programming and Scripting | 3 | 08-11-2005 04:28 PM |
| Command line traversal | videsh77 | UNIX for Dummies Questions & Answers | 7 | 06-13-2005 06:05 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi friends,
I was trying to traverse a file using FTS(3) . this is the code below.. but I am getting segmentation error in the line fts_read(...) , anybody have any idea , why it is? Please, help me. Thanks in advance. ------------------------------------------------------------------------------------------------------- Program: ------------------------------------------------------------------------------------------------------- FTS *fileStruct; FTSENT *dirList, *fileInfo; int ftsResult; fileStruct = fts_open(&argv[1], FTS_COMFOLLOW, 0); dirList = fts_children(fileStruct, FTS_NAMEONLY); do { fileInfo = fts_read(dirList->fts_pointer); fileStruct = fts_open((char * const *)dirList->fts_link->fts_name, FTS_PHYSICAL, (void *)result); }while (dirList->fts_link != NULL); ftsResult = fts_close(fileStruct); ------------------------------------------------------------------------------------------------------- Result of Debugging: ------------------------------------------------------------------------------------------------------- Starting program: a.out temp 0x0000000000400b78 in main () Current language: auto; currently asm (gdb) (gdb) n Single stepping until exit from function main, which has no line number information. -- Done with option processing. -- optind is 1 first non-option arg: argv[1] = 'temp' 200810090259 destination directory path : temp/200810090259 checking fileStruct is not null Program received signal SIGSEGV, Segmentation fault. 0x00007fc797a4d5c8 in fts_read () from /lib/libc.so.6 (gdb) bt #0 0x00007fc797a4d5c8 in fts_read () from /lib/libc.so.6 #1 0x0000000000400f4d in main () (gdb) Quit (gdb) ------------------------------------------------------------------------------------------------------- Last edited by jack85; 10-09-2008 at 05:04 AM.. Reason: updated |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|