How to code a read file line by line in linux C?
In windows C++ I use ifstream.
I dont know about linux, please advice?
Okay chill out guys, don’t down so much.
here is the code:
char fpath = "file.txt";
char names;
FILE *fp;
ifstream fs(fpath);
while (fs >> names)
{
// here is some buffer to send to a server.
}
So here I need to read each line from file.txt and send each of those to a server.
On linux you have the POSIX library available, so you want to use
getline.