Sponsored Content
Top Forums Programming How to write a code in C to search a file Post 302111117 by krishna_sicsr on Monday 19th of March 2007 07:30:12 AM
Old 03-19-2007
Data How to write a code in C to search a file

Dear All,
Plz give me some code that how can I search a file through a C program file may be in Present Directory or in its Sub-Directories and it should support Linux Platform. Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

search change write

i="1" while do k=`expr $i + 1` sed -e 's/"$i"/"$k"/' < somefile1.txt >> somefile2.txt i=`expr $i + 1` done ive been trying to : 1 from a file containing numbers in a row divided with correct number of 2 spaces to find the corresponding one 2 change the value 3 and append... (1 Reply)
Discussion started by: trilicno
1 Replies

2. UNIX for Dummies Questions & Answers

search change write

i="1" while do k=`expr $i + 1` sed -e 's/"$i"/"$k"/' < somefile1.txt >> somefile2.txt i=`expr $i + 1` done ive been trying to : 1 from a file containing numbers in a row divided with correct number of spaces to find the corresponding one 2 change the value 3 and append... (3 Replies)
Discussion started by: trilicno
3 Replies

3. Programming

Code to write the heap into a file

Hi everybody, i am doing a project on checkpoints, where in i need to write the heap area into a file. I have got a code which i need to analyze, also asked in the forum under solaris https://www.unix.com/solaris/135483-libckpt.html The heap is implemented as a link list given by the structure... (2 Replies)
Discussion started by: holla4ni
2 Replies

4. Shell Programming and Scripting

write shell script to search file in folder

hi .. i have a problem how to search file with date and version number(ms_2.0_dd/mm/yy_24)in folder.Here 24 is version number and compare the this file to other file which is in another folder and if does not match then copy this file to respective folder.Also copy different files in different... (1 Reply)
Discussion started by: shubhig15
1 Replies

5. Shell Programming and Scripting

search 3 file and write to 4th file (a bit complex)

hi buddies; rollbackip.txt:10.14.3.65 2 10.14.3.65 3 ... lookup.txt: ... 10.14.3.65 2 10.14.5.55 1 55 10.14.6.66 1 66 10.14.3.65 3 10.14.7.77 3 77 10.14.8.88 2 88 10.14.9.99 4 99 ... ip-port.txt ... port111 3 10.14.5.55 57 port111 2 10.14.5.55 51 port111 1 10.14.5.55 59 ->... (7 Replies)
Discussion started by: gc_sw
7 Replies

6. Shell Programming and Scripting

search any user files with write permission

Guys, i wanna get any user files with write permission (on user or group permission) for review but i confuse with -perm parameter. any body can help me to explain what is that mean? thank's (1 Reply)
Discussion started by: michlix
1 Replies

7. Shell Programming and Scripting

"Search for files in a file and write these files to another file which sould be in some other direc

Hi , Need to shell script to extracts files names and write those to another file in different directory. input file is inputfile.txt abc|1|bcd.dat 123 david123 123 rudy2345 124 tinku5634 abc|1|def.dat 123 jevid123 123 qwer2345 124 ghjlk5634 abc|1|pqr.txt 123 vbjnnjh435 123 jggdy876... (1 Reply)
Discussion started by: dssyadav
1 Replies

8. Shell Programming and Scripting

Need to search a particular String form a file a write to another file using perl script

I have file which contains a huge amount of data. I need to search the pattern Message id. When that pattern is matched I need to get abcdeff0-1g6g-91g3-1z2z-2mm605m90000 to another file. Kindly provide your input. File is like below Jan 11 04:05:10 linux100 |NOTICE... (2 Replies)
Discussion started by: Raysf
2 Replies

9. Shell Programming and Scripting

Search pattern and write line into another file

Hi, I have a file which contains the below details.. My requirement is to fetch all the lines which are starting with "ABC_XY_" into 1 file and rest of the lines (not starting with "ABC_XY_") into another file. Could you please help with what command needs to be used? file1.txt ----------... (12 Replies)
Discussion started by: satyaatcgi
12 Replies

10. Shell Programming and Scripting

Search text beween tags and write to file using awk

Hi Friends, I have a very big text file, that has code for multiple functions. I have scan through the file and write each function in seperate file. All functions starts with BEGIN DSFNC Identifier "ABCDDataValidationfnc" and ends with END DSFNC I need create a file(using identifier)... (2 Replies)
Discussion started by: anandapani
2 Replies
dlsetlibpath(3C)														  dlsetlibpath(3C)

NAME
dlsetlibpath() - set the dynamic search path used to locate shared libraries SYNOPSIS
[flag]... file... [library]... Multithread Usage This routine is thread-safe. Calls to affect all subsequent calls to and on any thread. DESCRIPTION
is one of a family of routines that give the user direct access to the dynamic linking facilities (using the option on the compiler or com- mand line). sets the dynamic search path used by and to locate shared libraries. libpath is the dynamic search path. It is a list of one or more path names separated by colons When searching for a library, the dynamic loader uses search paths in the following default order: 1. The dynamic search path specified in a call to 2. The environment variable. 3. The environment variable. 4. The embedded path of the calling module (executable program or shared library) for libraries named in calls to or For dependent libraries, the embedded path of the library that named it as a dependent is used. 5. The standard library path. 6. The current working directory. (This is only for libraries named in calls to and not their dependent libraries.) (See dld.so(5) for additional information on search paths and options that can change the order described above.) Any combination of these paths may be disabled by setting flags to one or more of the following flag values OR'ed together. If the follow- ing value is set, the dynamic loader does not search the specified location: Directories specified in the dynamic search path. Directories specified in the environment variable. Directories specified in the environment variable. Directories specified in the embedded path. Standard library directory. Current working directory. Multiple search paths can be disabled by OR'ing individual flags: flags = RTLD_FLAG_DISABLE_STD_PATH | RTLD_FLAG_DISABLE_CWD_PATH A single search path can be enabled by setting flags to the complement of the flag value that disables that search path: flags = ~RTLD_FLAG_DISABLE_DYNAMIC_PATH EXAMPLES
The following example illustrates the use of to set the dynamic search path and disable other search paths. For simplicity, error checking has been omitted. #include <dlfcn.h> int main() { void *handle; int status; int flags; /* Set dynamic search path and disable the embedded * path and the standard library directory. */ flags = RTLD_FLAG_DISABLE_EMBEDDED_PATH | RTLD_FLAG_DISABLE_STD_PATH; status = dlsetlibpath("/opt/lib:/opt/usr/lib", flags); /* Call dlopen to load a library using the dynamic * search path. */ handle = dlopen("mylib.so", RTLD_LAZY); /* Remove the dynamic search path and reenable all * disabled search paths. */ status = dlsetlibpath(NULL, 0); } RETURN VALUE
If successful, returns otherwise a non-0 value is returned. More detailed diagnostic information is available through or ERRORS
If fails, a subsequent call to returns one of the following values: Cannot allocate dynamic memory. Failed to apply relocation while resolving call to call failed on entry to call failed on exit from failed on entry to or exit from Invalid argument in call to SEE ALSO
dlopen(3C), dlopene(3C), dlgetfileinfo(3C), dlerrno(3C), dlerror(3C), dld.so(5). Texts and Tutorials: (See the option) (See manuals(5) for ordering information) dlsetlibpath(3C)
All times are GMT -4. The time now is 02:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy