I have macro I created that works fine on Ubuntu, but when I moved it to my windows 8 64bit machine, I can no longer open a file. I wonder if it is windows specific.
Filename is “num_bins” and stores the number of bins of data I have to plot. So basic data file.
I have it in both txt and dat file types and neither seems to work.
Basic code segment is as follows:
#include
#include
#include
#include
#include
#include
#include
#include <stdlib.h>
int main(){
…
std::ifstream file_num_bins(“num_bins”);
if (file_num_bins.is_open()){
getline(file_num_bins,line);
std::stringstream String_toInt(line);
String_toInt >> number_of_bins;
file_num_bins.close();
}
else{cout << "File did not open"; return 0;}
…
Macro and dat files are both saved in same folder of C:\root\macros
I have also tried for filename “num_bins.dat”, “num_bins.txt” to no avail.
I can open files in visual c++ just fine. So I don’t get the difference.
Any help would be appreciated.
Brian