The code on the C seems to be how much I looked through the forums, the code corrects I sin on entering dimensions from the keyboard displays a matrix filled with zeros when I added
if(fp==NULL) { puts("Open file error"); return; } It began to display "Open file error"
please tell me what the problem is
printf("Введите количество строк матрицы А "); scanf("%d", &m); printf("Введите количество столбцов матрицы А "); scanf("%d", &n); float A[m][n]; FILE* fp; fp = fopen("matrixA.txt", "rt"); if (fp == NULL) { puts("Open file error"); return; } for (i = 0; i < m; i++) { for (j = 0; j < n; j++) { fscanf(fp, "%f ", &A[i][j]); } } printf("\nМатрица А \n"); for (i = 0; i < m; i++) { for (j = 0; j < n; j++) { printf("%f\t", A[i][j]); } printf("\n"); } fclose(fp);
printf( "Can not open file \"%s\" : %s\n", filename, strerror(errno) );orperror( "Can not open file" );Without this - an underground knock, which makes no sense to discuss. - PinkTuxfp = fopen("matrixA.txt", "rt");does the lettertmean? Can there not be onlya,a+,w,w+,r,r+? - Max ZS