@Aia: I'm not sure exactly what he meant by that, do you? My guess was that he wanted to store the lines in memory. One way would be to declare a whole bunch of pointers, but a more reasonable way is to store them in an array of pointers. I also assumed (maybe wrongly) that the OP has a brain and he/she can use it to figure out how to put the code I posted in a loop. But maybe that was just asking too much.
Like anything else there are other ways to do it, such as linked lists. But I doubt the OP knows anything about them -- yet.
I do not know why every post that i put...there are always controversies..maybe my question was ambiguous.
The reply by Ancient Dragon is absolutely what i was looking for.
Actually the file contains IP addresses of diff servers on diff lines and i need to store each IP address in *host so that i can use a loop to connect to each server one by one.
I do not know why every post that i put...there are always controversies..maybe my question was ambiguous..
The more details you give -- with examples, restrictions, and when/where/what, the less ambiguous your question. Remember, only you know what you're doing. If you don't explain it to us well enough, controversy happens.