Category : file

I have a piece of code in an Eclipse IDE on Windows 10 where I’d like to delete a .txt file from a directory different from the one I’m working in. I’ve tried with std::remove("/SomeFolder/AnotherFolder/FileToBeRemoved.txt") but it didn’t do anything (I’ve included the <stdlib.h> library). The file is closed. I also tried std::filesystem::remove("/SomeFolder/AnotherFolder/FileToBeRemoved.txt") adding the ..

Read more

I am trying to create a HUD system for my text based sci-fi game, and to open a second window I need another process, if I am updating a text file with the necessary string for this to read from would this work? or is there a better method this is the cpp file void ..

Read more

Please this is really important, any ideas are VERY appreciated. I have been stuck on this for days. Updates: I have added some notes to make things clear. You can run the same code here on: https://onlinegdb.com/HyYP3qguu I wrote the following function in C++ which I call 3 times to open a file and writes ..

Read more

Updates: I have added some notes to make things clear. You can run the same code here on: https://onlinegdb.com/HyYP3qguu I wrote the following function in C++ which I call 3 times to open a file and writes to it: #include <unistd.h> #include <stdexcept> #include <iostream> #include <sstream> #include <sys/fcntl.h> using namespace std; bool try_num=0; void ..

Read more

I have added some notes to make things clear. You can run the same code here on: https://onlinegdb.com/HyYP3qguu I wrote the following function in C++ which I call 3 times to open a file and writes to it: #include <unistd.h> #include <stdexcept> #include <iostream> #include <sstream> #include <sys/fcntl.h> using namespace std; bool try_num=0; void cmd_execute() ..

Read more

I cannot figure out why this solution will let me open and modify files bytes with ofstream/ifstream, but reads/writes will not update the pointer accessed through tellp / tellg function calls. This is a sample that does not work: std::ofstream oStream(path,std::fstream::beg | std::fstream::binary); int test = 98; LOGI("OSTREAM POINTf :: %d", oStream.tellp()); oStream.write((char *)&test,4); LOGI("OSTREAM ..

Read more

this is upload table function void upload_table(){ ifstream file_read("billy.dat"); if(!file_read.is_open()){ cout << "Failed to open file!" << endl; } table obj; file_read.read((char*)&obj, sizeof(obj)); while(true){ tab.push_back(obj); if (file_read.eof()){ break; } file_read.read((char*)&obj, sizeof(obj)); } file_read.close(); cout << "tab size: " << tab.size() << endl << "Table information Uploaded Successfully!" << endl; } code in table_file.cpp // included ..

Read more