Category : ifstream

I’m struggling with reading file stream inside Android environment using C++ library. I believe I set all the permissions correctly (1st figure) and I’m getting the file path using Android internal library. Would you please give me a snippet to correctly read a file using std::ifstream.getline()? For instance, I get "/document/1EF7-1509:Download/015_1440.jpg" for the image file ..

Read more

I am completely new to the c++ and I have problem with managing input. I have a program where I want to be possible to read input from console but also from the file. I have class with private field std::istream &input_stream; and in constructor I set this input_stream as std::cin, however when my program ..

Read more

I have two programs. Program A spawns the child process Program B. Program B uses std::ifstream("file.txt") to read in a file. However, Program A is located in /programs/a/ while Program B is in /programs/a/children/b/. Meaning that when I spawn B as a child process, Program B thinks its current directory is /programs/a and looks for ..

Read more

I’m storing Port and IP addresses in a text file "info.txt" info.txt: 36451 192.184.255.255 48703 192.184.255.255 Pseudo code: errmsg.Clear(); ifstream fp(mLockFile.Str()); if (!fp.is_open()) { errmsg << "Could not open file " << mLockFile.Str(); return retval; } UInt16 port = 0; char ipaddr[1024]; char read[1024]; fp.getline(read, 1023); TLOG1("mLockFile fp read:%s",read); //I have added if(fp.getline(read, 1023)) { ..

Read more