Find the answer to your Linux question:
Results 1 to 10 of 10
Hi , In windows we can create ini file using winAPI but i want to know how to create ini file in Linux.I am beginner in Linux. Thanks in advance, ...
  1. #1
    Just Joined!
    Join Date
    Jul 2007
    Posts
    4

    How to create ini file in linux

    Hi ,

    In windows we can create ini file using winAPI but i want to know how to create ini file in Linux.I am beginner in Linux.

    Thanks in advance,
    A....

  2. #2
    Linux Engineer Zelmo's Avatar
    Join Date
    Jan 2006
    Location
    Riverton, UT, USA
    Posts
    1,001
    ini files for what, exactly?
    Stand up and be counted as a Linux user!

  3. #3
    Just Joined!
    Join Date
    Jul 2007
    Posts
    4
    ini file for log file ,consider in general.

  4. #4
    Linux Engineer Zelmo's Avatar
    Join Date
    Jan 2006
    Location
    Riverton, UT, USA
    Posts
    1,001
    Sorry, I must be thinking of the wrong type of ini file. The ones I've seen in Windows are ASCII text files that specify settings for a particular program, which the program reads as it starts up so that it knows how to behave. (A notable example is win.ini.)

    Do you have any links to examples of the kind you're talking about?
    Stand up and be counted as a Linux user!

  5. #5
    Just Joined!
    Join Date
    Jul 2007
    Posts
    4
    Yaa similar to what u thought ,that can be done on Windows using
    getprivateprofilestring function ,let me as such anything in Linux??

    Thanks
    A

  6. #6
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    I think you would just use fscanf to read a configuration file...

  7. #7
    Just Joined!
    Join Date
    Jul 2007
    Posts
    4
    Ha its not reading its creating a ini file

  8. #8
    Linux Enthusiast likwid's Avatar
    Join Date
    Dec 2006
    Location
    MA
    Posts
    649
    Then use open a pointer to a file and append or write what you need to the file? Linux is not Windows.

  9. #9
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    I've never programmed with the Win32 API, but I believe I understand what you're saying (it's similar to Mac OS X). Basically, your ini file holds preferences, and you interact with it through some sort of preference manager function.

    Well, since Linux programming is not generally done in a framework, this doesn't work any longer. Your preference file can be whatever you want, wherever you want, in whatever format you want. You decide, and manage it yourself. Some popular formats are a basic key-value pairing, XML, YAML, etc., but you really can make any format you want.

    And to do anything with it, you just open it up as you would any file, and have a go.
    DISTRO=Arch
    Registered Linux User #388732

  10. #10
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
    Posts
    1,117
    Hi.

    There are perl modules that can process INI files. For example:
    Config::IniFiles - A module for reading .ini-style configuration files.

    INI files consist of a number of sections, each preceded with the sec-
    tion name in square brackets. INI files consist of a number of sections, each preceded with the sec-
    tion name in square brackets. The first non-blank character of the
    line indicating a section must be a left bracket and the last non-blank
    character of a line indicating a section must be a right bracket. The
    characters making up the section name can be any symbols at all. How-
    ever section names must be unique.The first non-blank character of the
    line indicating a section must be a left bracket and the last non-blank
    character of a line indicating a section must be a right bracket. The
    characters making up the section name can be any symbols at all. How-
    ever section names must be unique.

    -- excerpt form perldoc Config::IniFiles
    And possibly someone may drop by with information on similar features in, say, Python ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...