Hi guys:

I am constructing this simply code to read a number of columns in a file, get a number and produce a new file. I am just not certain what is wrong. I used the same standard as an old code of mine so it should work but I get nothing. Any help.



//    Gustavo Cardona, 06JUN09
#include <iostream>
#include <fstream>
#include <vector>

using namespace std;

int main()
	char fileToRead[20];
	char fileToWrite[20];
	char programToRead[20];
	char corFile[20], filter[4], season[3];
	int numberImages;
	cout << "Enter name of input file to create command file: (e.g. comp_lpv.dat) ";
	cin >> fileToRead;
	cout << "Enter name for output file (e.g. comp_lpv.cl ";
	cin >> fileToWrite;
	cout << "How many companion stars: ";
	cin >> numberImages;
	cout << "Enter name of cor file (e.g. daom_il3.cor2) ";
	cin >> corFile;
	cout << "Enter the filter and season (e.g. il 3) ";
	cin >> filter, season;
	cout << "Name of the var file that you want to use: (e.g. var_instmag40.e) ";
	cin >> programToRead;
	ifstream in;
	ofstream out(fileToWrite);
	double xc, yc, ilmag, ilmage, ismag, ismage, vmag, vmage, vmi;
	vector<double> starId[numberImages];
	for(int i=0;i<numberImages;i++)
		if (in >>xc>>yc>>starId[i]>>ilmag>>ilmage>>ismag>>ismage>>vmag>>vmage>>vmi) 
			out << "!../vars/" << programToRead << " << DONE" << endl;
			out << corFile << endl;
			out << starId[i] << endl;
			out << "daom_" << filter << season << ".varinst." << starId[i] << endl;
		out << "DONE" << endl;
	return 0;

Thanks, I feel dumb I did not notice that. It runs smoothly right now


This article has been dead for over six months. Start a new discussion instead.