Jun 4, 2015 at 6:45am UTC
Hi guys,
This is a program I wrote. I believe the program should be right. You may comment, if it is wrong. However, when I compile, I dont get an error and it just runs it in linux. I have tried using g++, gcc, vc++ e.t.c. I dont know why the program is not compiling.It should generate an output file, which is not happening.
I use similar commands in linux.
g++44 -o test test.cpp | tee loglogcpp
g++34 -o test test.cpp | tee loglogcpp
g++ -o test test.cpp | tee loglogcpp
I even tried simpler codes and it is not running. I checked which c++ is it and it gives me a result too. Dont know what might be the issue. Any help is greatly appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
//Just writing the program to create the svrf file to and the last 9001 to the other layers
#include <iostream>
#include <fstream>
#include <iostream>
#include <queue>
#include <iomanip>
#include <map>
#include <string>
#include <cassert>
#include<algorithm>
#include<iterator>
using namespace std;
const int MAX_SIZE = 20;
int INPUTLAYER[MAX_SIZE][2];
int CALIBRELAYER[MAX_SIZE];
int i;
int j;
int nrow;
int main()
{
// Create variables to store matrix information in
ifstream fin; // Create input and output file streams ifstream fin; ofstream fout
ofstream fout;
fin.open("Layernamev2" ); // Open up file streams fin.open("input.txt"); fout.open("output.txt");
if (!fin)
{
cout << "File not found. Program terminates." << endl;
return 1;
}
//Getting the number of lines in the code.
else
{
cout <<" File is found" <<endl;
}
fout.open("output.txt" );
cout << "How many rows are in the matrix. ie. layernamev2 file? " ;
cin >> nrow;
cout << endl;
fout<<"//----------------------------------------------------------------------------// \n" ;
fout<<"// ENVIRONMENT SETUP //\n" ;
fout<<"//----------------------------------------------------------------------------//\n" ;
fout<<"PRECISION 1000 \n" ;
fout<<"LAYOUT SYSTEM GDSII" ;
fout<<"LAYOUT PATH \"PN550_gds_25may.gds\"" ;
fout<<"LAYOUT PRIMARY \"*\"" ;
fout<<"LAYER DIRECTORY \"layers\"" ;
fout<<"DRC RESULTS DATABASE \"output_forschematicextract.gds\" GDSII PSEUDO" ;
fout<<"DRC SUMMARY REPORT \"output.rep\"" ;
fout<<"DRC MAXIMUM RESULTS ALL" ;
fout<<"LAYOUT PROCESS BOX RECORD YES" ;
fout<<"LAYOUT PROCESS BOX RECORD YES\n" ;
fout<<"//----------------------------------------------------------------------------//\n" ;
fout<<"// LAYER DEFINITION //\n" ;
fout<<"//----------------------------------------------------------------------------//\n" ;
for (i=0; i < nrow; i++)
{
CALIBRELAYER[i] =1000+i;
}
for (i=0; i < nrow; i++)
{
fout<<"LAYER MAP " << INPUTLAYER[i][1] << " DATATYPE " << INPUTLAYER[i][2] << " " <<CALIBRELAYER[i]<<"\n" ;
fout<<"LAYER L" <<CALIBRELAYER[i]<< " " <<CALIBRELAYER[i]<<"\n" ;
}
fout<<"//----------------------------------------------------------------------------//\n" ;
fout<<"// Output //\n" ;
fout<<"//----------------------------------------------------------------------------//\n" ;
for (i=0; i < nrow; i++)
{
fout<<CALIBRELAYER[i]<<" {L" <<CALIBRELAYER[nrow]<<" AND L" <<CALIBRELAYER[i]<<"} DRC CHECK MAP L" <<CALIBRELAYER[i]<<" " <<INPUTLAYER[i][1] << " " << INPUTLAYER[i][2]<<"/n" ;
}
fin.close();
fout.close();
return 0;
}
Last edited on Jun 4, 2015 at 6:48am UTC
Jun 4, 2015 at 7:22am UTC
If the program is not compiling, then please tell us the errors you're getting.
Jun 4, 2015 at 7:45am UTC
I am not getting any errors. I tried compiling a basic code which just prints some random statement within an output file and works properly. The log file is also 0Bytes and has no info.
Basically, I have an input file. The file contains lot of rows and 2 columns. We are not sure how long the file is. However let me say an example of what I want. I am expecting that my code will provide me with this o/p. But this is not happening.
input file
12 0
13 0
22 1
Expected o/p
//----------------------------------------------------------------------------//
// LAYER DEFINITION //
//----------------------------------------------------------------------------//
LAYER MAP 12 DATATYPE 0 1001
LAYER MAP 13 DATATYPE 0 1002
LAYER MAP 22 DATATYPE 1 1003
LAYER L1001 1001
LAYER L1002 1002
LAYER L1003 1003
//----------------------------------------------------------------------------//
// Output //
//----------------------------------------------------------------------------//
L1001 {L1003 AND L1001} DRC CHECK MAP L1001 12 0
L1002 {L1003 AND L1002} DRC CHECK MAP L1002 13 0
I am hoping my code would do this, and give me the expected output.
Jun 4, 2015 at 8:01am UTC
you say
I am not getting any errors
but then in your first post you say
I dont know why the program is not compiling
I am confused.
If it's not compiling there
must be error messages. unless you have a very very bad compiler.
Anyway, i would suggest either stepping through your code to see why you aren't getting any output, or sprinkle some print statements through the code to try and achieve the same thing.
Last edited on Jun 4, 2015 at 8:01am UTC
Jun 4, 2015 at 9:01am UTC
Changed the code like this and it works. Dont know the reason. I cant cin any information that can be used in the code. But I think, it solved the issue.
ifstream fin; // Create input and output file streams ifstream fin; ofstream fout
fin.open("Layernamev2");
if(fin)
{
//string INPUTLAYER[nrow][2];
for(int i = 0; i < nrow; ++i)
{
for (int j = 0; j <2; ++j)
{
fin >> INPUTLAYER[i][j];
}
}
}
ofstream fout;
fout.open("output.txt");
fout<<"//----------------------------------------------------------------------------//\n";
fout<<"// LAYER DEFINITION //\n";
fout<<"//----------------------------------------------------------------------------//\n";
for (i=0; i < nrow; i++)
{
CALIBRELAYER[i] =1000+i;
}
for (i=0; i < nrow; i++)
{
fout<<"LAYER MAP "<< INPUTLAYER[i][0] << " DATATYPE "<< INPUTLAYER[i][1] << " "<<CALIBRELAYER[i]<<"\n";
}
for (i=0; i < nrow; i++)
{
fout<<"LAYER L"<<CALIBRELAYER[i]<< " " <<CALIBRELAYER[i]<<"\n";
}
fout<<"//----------------------------------------------------------------------------//\n";
fout<<"// Output //\n";
fout<<"//----------------------------------------------------------------------------//\n";
for (i=0; i < nrow-1; i++)
{
fout<<"L"<<CALIBRELAYER[i]<<" {L"<<CALIBRELAYER[nrow-1]<<" AND L"<<CALIBRELAYER[i]<<"} DRC CHECK MAP L"<<CALIBRELAYER[i]<<" "<<INPUTLAYER[i][0] << " "<< INPUTLAYER[i][1]<<"\n";
}
fin.close();
fout.close();
return 0;
}
Jun 4, 2015 at 9:02am UTC
Thanks a lot for your help :D