I'm trying to create a code to read from a file and count how many iterations the aforementioned word is in the .csv file then output it to the screen. I'm using Xcode and keep getting the (11db) error. Someone please Help!
Short .csv file extract
28/02/17 07:25 b"I'm done goodnight"
28/02/17 07:14 b'If I could loop the sound of my tiny dog drinking water so delicately it would make me this emoji: \xe2\x98\xba\xef\xb8\x8f'
28/02/17 02:33 b'About last night...\xe2\x9c\xa8\xf0\x9f\x8d\xab @jpgaultier @vanityfair
27/02/17 20:01 b'Last night was wild! Even I woke up with an #Oscar! (harharharhar)
27/02/17 05:51 b"You're a winner KP
27/02/17 05:12 b'WHAT WAIT OMG'
27/02/17 05:12 b'KATY HERE. I lost a bet for best picture (I wanted moonlight...'
27/02/17 05:10 b'I just want to say VICE is the best thing ever and Shane smith has a fine head of hair.'
27/02/17 03:37 b'RT @RheaButcher: Ever. In 2017.
26/02/17 23:19 b'GET OUT and see "Get Out" ASAP! Love my girl aw in it
Code
#include <stdio.h>
#include <cstring>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream fin("/Users/williamthatcher/Desktop/TwitterFeed/sampleTweets.csv"); //opening text file
int count=0;
char ch[20],c[20];
cout << "Enter any word you want to count:";
cin>>c;
while(fin)
{
fin>>ch;
if(strcmp(ch,c)==0)
count++;
}
cout<<"Occurrence of word" << c << " = " << count << endl;
fin.close(); //closing file
return 0;
}