Programming :: Reading Configuration Files In C

Nov 11, 2010

I am currently writing an engine using SDL and openGL, and while I've gotten it mostly done, I've never really learned how to read configuration files. The configuration files that I'm hoping on using will be a straight forward syntax using "#" for comments and variables will be declared using "foo=hello". I don't need a lot of items in the configuration files, but enough to change needed settings. I'm not wanting to use external libraries (how are you going to learn if you can't do it yourself? :P) and I'm hoping to write it from scratch. If someone could please point me to a tutorial on how to do this or even some working code I may be able to figure it out. I am using the C programming language also(as I like it more than C++, sorry).

View 5 Replies


ADVERTISEMENT

Programming :: Reading API Files From SO Library

Jul 27, 2010

If we have a .so library elf in linux, will it be possible to find out the APIs supported by it. Or in other words, the functions that can be used along with the argument types and return type.? Note that we dont have any other header files or documentations related to the library.

View 5 Replies View Related

Programming :: Reading Data From Multiple Files?

Mar 17, 2011

I have a folder which includes bunch of folders each having data files in them. [ Folder A has F1, F2 F3 ..... F1000 folders in it, and F1, F2, F3 ... each has about 10 different files named FILE 1, FILE2, FILE3 .... in them.

I am interested in File 1 of each Folder, because that contains the data I need in it. More specifically, that File1 s have a line "ANSWER=..." in them, and i need to get that value of the ANSWER from each file. So doing it by hand is so hard, so I need to write a script that will scan all folders and give me a list of values of eache ANSWERs.

View 4 Replies View Related

Programming :: Reading And Writing Text Files In C?

Jan 1, 2011

Reading and writing text files in C?

View 9 Replies View Related

Programming :: Reading Files In A Directory Using Bash?

Nov 6, 2010

I am trying to write a simple script to list all the files in a directory. The script I wrote was as below where the pdb_files is a directory and all the files which I want to list are in that folder.

Code:
files=`ls -F pdb_files/*THERMO*`
for inFiles in $files
do
echo $inFiles

[Code]....

View 5 Replies View Related

Programming :: Bash Reading Multiple Files Line By Line?

Mar 8, 2011

I have a set of files containing data that I need to re-arrange into one single property list.

The files that I have look like this:

Code:
# cat uk
<string>10</string>
<string>11</string>
...
<string>29</string>

[Code]....

So the lines in the files match up but I haven't found a way of reading several files line by line.

View 3 Replies View Related

Programming :: Edit Configuration Files More Than One Server By Shell Script

Feb 7, 2011

how to write shell script(awk/sed or any other) to edit value of parameters in configuration files on same server or remote server.

View 3 Replies View Related

Ubuntu :: Reading Old 1998 .doc Files With Oo

Jan 2, 2011

I have over 200 old .doc files that I cannot read properly with oo. Some of the files just give e one line of what looks like formatting info and the rest of the files show the text but in the middle of garbage and not formatted. If I use a winXP machine and get the MSWord add-on from MS it will read these. I do not like to use Win machines and also I need a batch method for the conversion, either to odf or docx format.

View 7 Replies View Related

Ubuntu :: Reading .mdf Image Files?

Jun 27, 2011

i would like to burn an image to a dvd but the image file is in .mdf format like that of many images created in alcohol 120%. what do i need to do in windows to burn such an image or be able to read the file?

View 2 Replies View Related

Programming :: Not Reading Non-ASCII Characters

Apr 26, 2010

Well, I have a web application in Linux server. All my Java codes are there. FYI, whenever user entered non-ASCII characters(e.g. ∞,�,�) in a text field in my web application, and I check the log of my Java code in Linux server, it returns weird characters.

Suppose user entered ∞ in the text field. I should get ∞ in my log too. However, I got weird characters in return.

View 14 Replies View Related

Software :: Reading Files In Shell Scripting?

Oct 25, 2010

I am trying to read the fields of a file and manipulate them, record by record. Lets say using awk :

awk -F":" `{print $1 $2 $3 $4 $5}' TrackMsgFile.0806`

This prints my fields on screen.But I dont want to print these fields while reading the records instead store them in some variable and manipulate them as per my logic. Does "awk" or some other shell command provides something for this ?

View 14 Replies View Related

CentOS 5 :: Rythmbox Not Reading Music Files?

Dec 25, 2010

The other day I got a SMC Network EZ-Stream Internet SMCWAA-G radio device and I am having some issue serving music to it from Linux.

It says it runs with MusicMatch or Rhaposdy on Windows. I want to run this from my Linux CentOS system.

So I was looking at Rythmbox which is on the OS already .

I have my mp3 and dvs on a Buffalo link station. I can mount the drive and see the music files OK at the browser level.

When I go into Rythmbox and select the files to be loaded into the library they appear to be grayed out.

Also I cannot select an entire older. I want to take everything in my mp3 dir that has my music broken out via artist and type etc.

Can this SW also be used to server out to my device like MusicMatch or Rhapsody? How do I configure the sw to be a server and run in the background?

I dont want to leave a windows system up on-line just for Music. I prefer Linux.

Is there other sw that might be better fro this function?

The device works fine on the network and gets Internet radio fine.

I just looked at the error file for Rythmbox and notice an error of

The GStreamer plugins to decode "MP3" files cannot be found

What is that? I tried a yum install gstreamer And I got the following : Setting up Install Process Package gstreamer-0.10.20-3.el5.i386 already installed and latest version Nothing to do

View 3 Replies View Related

Programming :: Reading File - Output From Xrandr -q

Jul 24, 2010

Code:

I'm trying to make several files: each named after the display and containing resolutions. But for some reason I get null when trying to read lines.

View 2 Replies View Related

Programming :: Bash Reading Arguments, Most Effective Way?

Aug 17, 2010

I've been reading about getopt and getopts but it doesn't seem like it's possible to parse arguments like --foo or even -foo. I've started my own script trying to achieve this, but I'm still wondering if I'm losing performance and if there is a better way to do this task.

Also I'm using the [[ =~ ]] regex syntax which seems to be available only in newer bash versions, should it be a big issue? My bash version: GNU bash, version 4.1.7(2)-release (x86_64-unknown-linux-gnu)

[Code]...

View 6 Replies View Related

Programming :: Reading A Binary File Which Is In Hexadecimal

Jan 9, 2011

I have a binary file, which I need to process using my C++ application. Only thing I know is first chunk of the file is long, second chunk is int, third chunk is char etc... The binary file actually contains something like below. (which is represented in hex base).

D7 07 00 00 00 00 00 00 37 18 00 00 DE 07 ............ so on.....

I need to procees the file in the following way.

* I know the first data segment in my file is long. So it takes 4 bytes.
* so I need to read the first four bytes. That is D7 07 00 00.
* Then I need to reverse this as 00 00 07 D7.
* Finally I need to get the decimal value of above hexa decimal line. ( 00 00 07 D7)
* i.e. 00 00 07 D7 (in hex) = 7D7 (in hex- after removing leading 0 s) = 2007 (in decimal)

Like wise I need to process the whole file.

View 14 Replies View Related

Programming :: Reading Text File Into An Array

Oct 20, 2010

I know that this is a really simple thing to do but I just can't figure it out. How do I read a text file into an array in C++?

View 3 Replies View Related

Programming :: Reading A File Of Data In An Array?

Feb 10, 2011

I have two files of data with different numbers of columns and rows. I want to read this two files in two arrays and then compare for example the second column of first data file with the third column of the other text file and if the difference between of two numbers is less than a threshold then the program print the information in the rows which fulfill this condition in the third text file. I have written below program but the problem is that it does not go through all rows of second file.

declare -a a
declare -a b
r=` awk '{n++} END {print n}' second.txt `
echo $r
awk '
{

[Code]....

Actually I have two data files one of them contains 44406 and the other one has 12066 rows and I want to check whether the difference between the components of two specific columns is less than a threshod but I have simplified it here. I had written this code and then I have realized that this code just goes through the number of rows as the same as the first.txt file and ignores the rest. I could not find the problem yet.

View 2 Replies View Related

Programming :: Reading A Simple File Format In C?

Dec 16, 2010

I made a string key-value mapping struct in C, and functions to add and remove entries. I would also like to write a function to read in this file format:

Code:
key: value
another: another value

[code]...

View 14 Replies View Related

Programming :: Reading From Text File In Bash?

Nov 8, 2010

I need to Read a path of a file witch is written in Text file i used this

Code:

FILENAME=$1
while read line
do
echo $line
done < $FILENAME

it worked and showed me the Line witch was written in my file but now my problem is how am gonna use that line as a path i mean for example if am gonna execute a linux command on that file like dpkg -i /path/to/the/file how am gonna export it from The $Line variable and use it after the command.

View 14 Replies View Related

Programming :: Reading Incoming Mail For Script?

Sep 17, 2010

I plan to make a script for the console server via mail, but I find difficulties in the reading of email applications, to email me using the mail command, but how to read the incoming mail

View 1 Replies View Related

Programming :: Reading Lines Within A File (Perl)?

Mar 16, 2011

I am trying to read certain lines within a file and give the output of the certain lines that dont equal my value, I think showing you would be easier. There is multiples of these inside one file...

Code:

LV Name /dev/vg00/lvol1
LV Status available/syncd
LV Size (Mbytes) 300lable/syncd

[code]....

I want to read everything in the file, if the status is not available then it should display the name (directly above status). If they are all availbale then do nothing. I think I know how to do it which includes putting the info in string form and placing in hash but it is proving to be out of my skill range.

View 12 Replies View Related

Programming :: Reading Specific Lines From A File?

Sep 10, 2009

To save on the writing of WAY to many files with very little in them, I want to put it all in one file and read a specific few lines. There will be six variables to be read at a time. Format is as such:

//Set 1
string name
5
12

[code]....

From name to 5th number is a set. The name will be of different lengths for each set. This will be a big file of probably 40+ sets. My problem lies in reading one and only one set be it set 5 or set 34. It needs to be done in C++.

View 2 Replies View Related

Programming :: Reading/writing Every Frame On Ethernet?

Dec 3, 2010

I would like to write a program that can read every ethernet frame arriving on a specific hardware NIC, without a TCP/IP stack otherwise doing anything on that NIC. Likewise I want to be able to write out to that NIC. So every arriving ethernet frame, of all types, would be readable (probably one at a time to preserve frame boundaries). And every write of exactly that same data would send frames out. The data read and written would be the whole ethernet frame. The kernel would do nothing else with this data, but other NICs would still operate as usual.

What I would be doing is that on 2 separate NICs, copying frames from one to the other, as in bridging. But I would also be doing modifications per what my program needs to do (not at liberty to say what that would be). What facility would I need to be looking at to do this? There is no ethernet device file. Would raw sockets be able to do this? The programming language will be C.

View 4 Replies View Related

Programming :: Unread Log Entry When Reading Log In Java?

Apr 13, 2011

i want to make program that processing entry in log on real time... I have try to pass "tail -f -n 1 /var/log/messages" command from .runtime().exec and process the output,, description of the algo is like this

-passed to exec()
-read output
-if not same as previous value procces it

but sometimes it loose some entry to procces, maybe it occur when proccesing another entry is added by system...

View 6 Replies View Related

Programming :: Writing And Reading Driver Value In Ioctl?

Jan 18, 2011

I just want to read and write some values (integer) to my driver. I used put/get user but always getting errors.

driver

Quote:

int Wert;
static int device_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsinged long arg)
int ret;

[code]...

Quote:

int WERT
ret=ioctl(fd, SETIT, WERT)
ret=ioctl(fd, GETIT, WERT)

if i say in C++ WERT is 5 the value arg of the driver becomes 5 but not WERT the returnvalue of get and put user is -1 so it failed.

View 12 Replies View Related

Ubuntu :: Permission Denied When Reading Files From Old Harddisk?

Mar 15, 2010

I had ubuntu 9.04 on a laptop, and it kept crashing, so I removed the harddisk, connected it via a Sandberg Harddisk to USB stick, and it works when I connect it to another ubuntu (running from livecd), but some of the files are locked, and I cannot open them copy them or anything else. What do I do?

View 2 Replies View Related

Ubuntu :: Reading EXIF Data From TIFF Files

Aug 9, 2010

I'm having trouble reading EXIF data from TIFF files. Both 8 bit and 16 bit fail to load EXIF data via eye of gnome and GIMP and I'm not sure why. Neither files downloaded online nor rendered from Bibble 5 seem to work. Using Ubuntu 10.04 64bit and GIMP 2.7.2.

View 2 Replies View Related

Ubuntu :: Reading Chinese Spreadsheet Files In Java

Apr 6, 2011

how to read data from excel to java in the excel sheet chinise language is present while reading into java iam getting question marks.how to get chiniese language instead of question marks in the java file

View 1 Replies View Related

CentOS 5 :: Reading Server Crash Dump Files

Oct 18, 2010

Is there any command available inorder to read the server crash dump files?

View 4 Replies View Related

Programming :: Reading And Writing White Spaces To A File?

Dec 2, 2010

I am trying to read a file character wise and trying to write the same character to another file. In this process, I unable to read and write white spaces successfully to the new file. The script reads the white spaces but while writing the white space is lost. The section of the code, is given below. Please advice how can i read and retain the white space while writing to a new file.

Code:

if [ -s f_test.txt ] && [ -f f_test.txt ]; then
echo "File Exists !!"
while read -n1 char; do

[code]....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved