<div dir="ltr"><div><div>Hi Jasem and Akarsh,<br><br></div>I am trying to test whether the code I wrote opens the constellationsart.txt file and reads contents from it. I am able to build kstars succesfully, but whenever I run kstars from the terminal, I get this qDebug() message saying that No constellationsart.txt file found for sky culture. Here is the class:<br><br>class ConstellationsArt<br>{<br>private:<br> QString abbrev, imageFileName;<br> int x1,y1,x2,y2,x3,y3,hd1,hd2,hd3;<br> <br> /*Draw the constellation art<br> void draw( SkyPainter* skyp ) const; */<br><br>public:<br><br> //Constructor<br> explicit ConstellationsArt(int serial);<br><br> //Destructor<br> virtual ~ConstellationsArt();<br><br> //@return the object's x1<br> inline int getx1() const { return x1; }<br><br> //@return the object's y1<br> inline int gety1() const { return y1; }<br><br> //@return the object's x2<br> inline int getx2() const { return x2; }<br><br> //@return the object's y2<br> inline int gety2() const { return y2; }<br><br> //@return the object's x3<br> inline int getx3() const { return x3; }<br><br> //@return the object's y3<br> inline int gety3() const { return y3; }<br><br> //@return the object's hd1<br> inline int gethd1() const { return hd1; }<br><br> //@return the object's hd2<br> inline int gethd2() const { return hd2; }<br><br> //@return the object's hd3<br> inline int gethd3() const { return hd3; }<br><br>};<br><br></div>Here is the .cpp file. <br>ConstellationsArt::ConstellationsArt(int serial)<br>{<br><br> // Find constellation art file and open it. If it doesn't exist, output an error message.<br> //QString artFileName = "constellationsart.txt";<br> KSFileReader fileReader;<br> if ( ! fileReader.open("~/Projects/kstars/kstars/data/skycultures/western/constellationsart.txt" ) )<br> {<br> qDebug() << "No constellationsart.txt file found for sky culture";<br> return;<br> }<br><br> while ( fileReader.hasMoreLines() ) {<br> QString line;<br><br> line = fileReader.readLine();<br> if( line.isEmpty() )<br> continue;<br> QChar mode = <a href="http://line.at">line.at</a>( 0 );<br> //ignore lines beginning with "#":<br> if( mode == '#' )<br> continue;<br><br> serial=line.mid(0,2).trimmed().toInt(); //reads the first column from constellationart.txt<br><br> // reads the serial number for each constellation, matches it, if matched then reads the details<br> if(mode==serial){<br> //Read pixel coordinates and HD number of star 1<br> x1 = line.mid( 3, 3 ).trimmed().toInt();<br> y1 = line.mid( 7, 3 ).trimmed().toInt();<br> hd1 = line.mid( 11, 6 ).trimmed().toInt();<br><br><br> //Read pixel coordinates and HD number of star 2<br> x2 = line.mid( 18, 3 ).trimmed().toInt();<br> y2 = line.mid( 22, 3 ).trimmed().toInt();<br> hd2 = line.mid( 26, 6 ).trimmed().toInt();<br><br><br> //Read pixel coordinates and HD number of star 3<br> x3 = line.mid( 33, 3 ).trimmed().toInt();<br> y3 = line.mid( 37, 3 ).trimmed().toInt();<br> hd3 = line.mid( 41, 6 ).trimmed().toInt();<br><br> abbrev = line.mid( 48, 3 );<br> imageFileName = line.mid( 52 ).trimmed();<br> }<br> qDebug()<< "Serial number"<<serial<<"abbreviation"<<abbrev; <br> //testing to see if the file opens and outputs the data<br> }<br>}<br><div><br><br></div><div>I have tried giving it the absolute path of the file. I also tried putting constellationsart.txt into the build directory. What happens is KStars compiles, but the console tells me that the file constellationsart.txt didnt open. <br><br></div><div>Secondly, I want to see the contents of Hendry-Draper.idx, just to be sure that all the HD numbers listed in constellationsart.txt are listed there too. How do I do that?<br><br clear="all"></div><div><div><div><div><div class="gmail_signature"><div dir="ltr"><div><div>M.S.Adityan</div><div dir="ltr">Website: <a href="http://www.msadityan.com" target="_blank">www.msadityan.com</a><div><a href="https://www.linkedin.com/in/msadityan" target="_blank">https://www.linkedin.com/in/msadityan</a><br></div></div></div></div></div></div>
</div></div></div></div>