Extracting data from different files into separate files using c

Soldato
Joined
10 Apr 2004
Posts
13,497
Small project of mine over the summer which im failing miserably at, basically trying to extract my iPhones text database into separate contacts for easy reading back later. Serves no use at all but Im trying to enhance my coding knowledge but this one has got me very stuck.

I'm using C on Xcode if that matters.

Right basically got data like so:

CSV file one:
Code:
ID, Number, Date/Time,Sent/Recieved
2,447815784588,1236341544,2
3,447815784587,1236351524,2
6,447757845414,1236369574,2

CSV file two:
Code:
Text 1
Text 2
Text 3

I've got as far as getting the app to combine the data, line for line.

Problem lies in how to then separate each number out with its text message, sent/received value (2 being received) and the time and date.

Was thinking some sort of array to compare the values but after 6 hours i've got absolutely no where.

Anybody got any ideas on how I should approach this?

Some sample code would be nice (and then once I understand WTF is going on I can make it work with my data!)

Cheers :)
 
So does CSV 2 contain the message sent and CSV 2 what the message content is. Is the file ordered with the record at the first position in CSV 1 the same as that at csv file 2?

if thats the case then its a relatively simple task of creating a struct containing: id, number, date/time, sent/received and text. Then create an array of that struct which is long enough to contain your data (dynamically resizing if not). Then read in CSV file with position 0 going to position 0 of your struct array all the way to the end. Then the same with the csv file 2. Unless i have miss interpreted the problem...
 
Back
Top Bottom