Code compiles etc. but just hangs on run
My program is meant to parse through a text file, extract relevant data and then save it in a SQL table. I compile it like so..
gcc -o parse parse.c -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient_r
then I run it like so...
./parse > tweets.rss
But it just hangs. it doesn't print any printf's I put in to debug. Whats wrong? here is my code...
http://pastebin.com/3R45zyMp
I'开发者_开发技巧d appreciate any help!
You are specifying that it should write to tweets.rss instead of read from it. Since your program reads from STDIN as the first thing it does and you don't supply any input, why would you expect any output?
Try:
./parse < tweets.rss
The following is going to loop for ever.
while(c!= ' ' || c != '\t' || c != '\n' || c != '>'){
c = getchar(); //Get a new char
test[i] = c;
i++;
}
c can only be equal to one of them, so the condition will always be true.
精彩评论