Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-27-2004, 12:06 PM   #1
Registered: May 2003
Posts: 256

Rep: Reputation: 30
Question C Conversion Program

Can someone please show me some C code that would convert this:

FIELD_0: 00:00:01
FIELD_1: hello
FIELD_2: world
FIELD_3: hi
FIELD_4: planet

to this:

==hello world
Old 01-27-2004, 12:12 PM   #2
LQ Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
Where did the "hi" go?

Rather than just giving you some code, I'll give you some suggestions: Look into the C function called strtok(), which takes a C-style character array and splits it up based on a delimiting character. You could use strtok() to break each line up and get the value of the fields.

Without knowing how generalized you want your algorithm to be, though, you could do it in a simpler way by just searching through each line until you find a ":", and then reading in everything after that for the value of the field.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Any Good Conversion Program? caesium5 SUSE / openSUSE 6 09-01-2005 11:56 AM
C Program Problem (temp conversion) username17 Programming 11 05-16-2005 01:57 PM
Total Conversion? guy Linux - Hardware 4 11-25-2003 06:54 PM
double conversion Xiangbuilder Programming 15 10-09-2003 09:12 AM
File Conversion justaguynsrq Slackware 4 05-26-2003 07:10 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:20 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration