fgets

PHP fread problem

hi guys, ive ran into an issue while creating a PHP telnet script at work to gather network data. as the amount of data returned from the 'Action: Status' command could be of any size... im concerned about using a static number with fread() on line 13. I have also tried using fgets() instead but it only grabs the first line of data (t...

How do make an array that fits string from stdin?

I am trying to use 'gethostbyname'. If I hardcode a host name directly into the function call it works great. However, I am trying to pass user input into this function. I believe my problem may because the array I am passing to the function has many trailing whitespaces. void connectHost(char *hostname) { int n; //This ...

Tips on how to read last 'word' in a character array in C

Just looking to be pointed in the right direction: Have standard input to a C program, I've taken each line in at a time and storing in a char[]. Now that I have the char[], how do I take the last word (just assuming separated by a space) and then convert to lowercase? I've tried this but it just hangs the program: while (sscanf(line...