So in Code::Blocks in Ubuntu (latest).
I have a project in which I load a file and read a number from it.
#include <fstream>
using namespace std;
int main(){
ifstream in("data/file.t");
int n;in>>n;
}
now with a cout<<n
it shows -1203926
(and other random numbers) though the number in the file is 0
.
data
is where the binary is(I mean data and binary are in the same folder(Program)) and I was expecting the path to be relative like in Windows... but only if I put the full path /home/csiz/Desktop/C++/ep0/Program/data/file.t
it will get me a 0
.
Can you tell me how to make it a relative path? I would prefer something so that in Windows the code can compile without any changes.