473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to create a simple configurationfile parser?

Hey there.

I'm writing a small application that has a belonging
configuration-file.

At the moment, I'm parsing the file with basic for-lops, but this is
pretty slow, and also I need to extend the parser to be able to read
more configuration-entries.

A friend of mine told me I should take a look at yacc/lex, and so I
googled for hours for some simple examples on this. I didn't really
find anything useful.

So my question is, could someone please post a simple example on how
to parse generic 'option = value' files with C and yacc/lex?

Thanks in advance.

--
Mvh. / Best Regards,
Jesper Nøhr <je****@noehr.org>
Nov 14 '05 #1
1 1342
"Jesper N?hr" <je****@noehr.org> wrote in message
news:69**************************@posting.google.c om...
I'm writing a small application that has a belonging
configuration-file. [snip] So my question is, could someone please post a simple example on how
to parse generic 'option = value' files with C and yacc/lex?


If it really is "option = value", yacc/lex is almost certainly overkill. I'm
sure there are plenty of people who have implemented ".ini" file parsers
(which are option/value pairs classified into "sections"), you should be
able to Google up some source...
Nov 14 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Dan | last post by:
Using XML::Simple in perl is extreemly slow to parse big XML files (can be up to 250M, taking ~1h). How can I increase my performance / reduce my memory usage? Is SAX the way forward?
4
by: Greg B | last post by:
Well since getopt() doesn't seem to be compatible with Windows, and the free implementation of it for Windows that I found still had some annoying restrictions, I thought I'd whip up a simple...
6
by: Sebastian | last post by:
Do you have a simple example for creating a simple hello world compiler in c# or vb.net? thanks Sebastian
1
by: John Blair | last post by:
hi,I have the following code which gives an error in VB.Net when i run it that it cant find the assembly SimpleControlSamplesVB? any ideas how to resolve this error? Thanks for any help! J. ...
1
by: John Blair | last post by:
hi,I have the following code which gives an error in VB.Net when i run it that it cant find the assembly SimpleControlSamplesVB?any ideas how to resolve this error? Thanks for any help! J.Parser...
3
by: matofarides | last post by:
Hello all! I was wondering whether there was a way, using any XML parser (preferably xerces), to create an XML file by reading, line by line a text file. Thank you, Marios Tofarides
5
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no intention of going through whatever hell that would...
4
by: =?Utf-8?B?SmFu?= | last post by:
In my application the user can configure automation-scripts by inserting different "actions" into a "procedure". These different procedure- and action-objects are all translated into C# code before...
7
by: bvdp | last post by:
Is there a simple/safe expression evaluator I can use in a python program. I just want to pass along a string in the form "1 + 44 / 3" or perhaps "1 + (-4.3*5)" and get a numeric result. I can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.