I am new to coding and using code blocks in windows. But now I need to run a code in the Linux system but I am not getting the output what I am getting on my windows system. Please help to solve the problem.
Input for my code is in a text file that consists of the following inputs:
5
3 0 1 2
3 3 4 5
4 0 1 4 5
4 3 4 1 2
4 3 5 2 6
The code reads the text from the file and prints the output
#include<stdio.h>
#include <stdlib.h>
#define MAXLITTERM 10
#define MAXTERMS 10
int givenSOP[MAXTERMS][MAXLITTERM];
int main()
{
int column[10];
char name[] = "input.txt";
FILE *f1 = fopen("input.txt","r");
int i,j;
char S;
fscanf(f1,"%d",&givenSOP[0][0]);
printf("\n %d\n", givenSOP[0][0]);
for(i=1;i<=givenSOP[0][0];i++)
{
int point = ftell(f1);
column[i] = 0;
S = getc(f1);
S = getc(f1);
while(!feof(f1))
{
if(S=='\n')
{
S = getc(f1);
break;
}
if(S!=' ' && S!='\n')
column[i]++;
S = getc(f1);
}
fseek(f1,point,SEEK_SET);
for(j=0;j<column[i];j++)
{
fscanf(f1,"%d",&givenSOP[i][j]);
}
}
for(i=1;i<=givenSOP[0][0];i++)
{
for(j=0;j<=givenSOP[i][0];j++)
{
printf("%d ",givenSOP[i][j]);
}
printf("\n");
}
return 0;
}