Linux / UNIX Tech Support Forum
This is a discussion on How to read configuration file line by line in C ? within the Coding in General forums, part of the Development/Scripting category; I'm in Linux Box (fedora) I have my config file : myfile.conf Code: scriptPath=/opt/myscript DBserver=localhost DBuser=me DBpassword=#123^abc# how can I ...
|
|||||||
| Coding in General Discussion on PHP/Perl/Python/Ruby/GNU C or C++. MySQL, PgSQL and (X)HTML or any other programming languages you want. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I'm in Linux Box (fedora)
I have my config file : myfile.conf Code:
scriptPath=/opt/myscript DBserver=localhost DBuser=me DBpassword=#123^abc# and store its line to variable to use in the C application ! |
| Sponsored Links | ||
|
|
|
||||
|
One approach is to read whole file in a loop and than use C function to read field while using = as deliminator.
Another option is to use C/C++ ini-parser http://student.agh.edu.pl/~koshmaar/SDL_Config/news.php
__________________
Vivek Gite Linux Evangelist |
![]() |
| Tags |
| c programming , gcc , gnu , ini parse , linux read ini files |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script to open and read a file that is supplied as a command line arg | blingbling | Shell scripting | 3 | 03-31-2009 10:54 AM |
| Shell script to count number of lines in file specified by the second command-line | seaman77 | Shell scripting | 1 | 03-16-2009 07:46 PM |
| How to add new line using sed | vprajeesh | Mail Servers | 0 | 03-03-2009 09:22 PM |
| HPUX Unix comparing 2 large files line by line | raj | HP-UX | 1 | 02-11-2008 05:20 PM |
| Omit the first line in a file | c341 | Shell scripting | 4 | 12-29-2006 02:07 PM |