so estou programando em c, mas gostaria de saber como passo esse arquivo binario para arquivo normal, pq no item 2 ele pede para ler um sistema do blocos de notas.
#include <stdio.h> //função de entrada e saida
#include <stdlib.h> //função que envolve alocação de memoria
#include <time.h> //função de manipulação de unidade de tempo
#include <locale.h> //define o idioma para a localidade padrao do sistema
#include <string.h> //funcao que manipula strings
#define MAX_ORDER 10
const int ERRO_NENHUM = 0;
typedef struct{
int ordem;
int posto;
float A[MAX_ORDER][MAX_ORDER];
float x[MAX_ORDER];
float y[MAX_ORDER];
}Sistema;
int main(){
setlocale(LC_ALL,"");
int EOF_ctrl; //controle para n ler algo duplicado
int i, j, k, n = ORDEM_MATRIZ, escolha, aux;
float c, soma = 0.0, x[10];
Sistema sistema;
FILE *arquivo;
while(escolha != 6){
puts("------------ Cálculo de um sistema linear -------------- \n");
puts("1 - Inserir manualmente o sistema.");
puts("2 - Carregar um sistema de um arquivo texto.");
puts("3 - Determinar a solução do problema.");
puts("4 - Exibir um sistema.");
puts("5 - Ordenar sistemas.");
puts("6 - Sair do programa.");
puts("-------------------------------------------------------- \n");
printf("Digite o número desejado: ");
scanf("%d", &escolha);
printf("\n");
switch(escolha){
case 1:{
printf("\n\n******************* Coleta de Dados ********************* \n\n");
char nome_arquivo[100];
printf("Qual o nome do arquivo? ");
scanf("%s", nome_arquivo);
strcat(nome_arquivo, ".txt");
printf("Qual a ordem da matriz? ");
scanf("%d", &sistema.ordem);
arquivo = fopen(nome_arquivo, "a+b");
if(arquivo == NULL){
printf("Problemas na abertura do arquivo!");
}else{
printf("Arquivo criado com sucesso!\n");
}
for(i = 1; i <= sistema.ordem; i++){
for(j = 1; j <= sistema.ordem + 1; j++){
printf("\nElemento[%d][%d] = ", i, j);
scanf("%f", &sistema.A[i][j]);
}
}
fwrite(&sistema, sizeof(Sistema), 1, arquivo);
if(ferror(arquivo)){
printf("\nErro na gravacao\n");
}else{
printf("\ngravacao ok");
}
if(!fclose(arquivo)){
printf("FECHAR: sucesso no fechamento");
}else{
printf("FECHAR: ERRO NO FECHAMENTO");
}
printf("\n\n******************* Saida de Dados ********************* \n\n");
for(i = 1; i <= sistema.ordem; i++){
for(j = 1; j <= sistema.ordem + 1; j++){
printf ("\nElemento[%d][%d] = %.2f\n", i, j, sistema.A[ i ][ j ]);
}
}
printf("\n\n******************* Forma matricial do sistema ********************* \n\n");
for(i = 1; i <= sistema.ordem; i++){
for(j = 1, aux = 1; j <= sistema.ordem + 1, aux < sistema.ordem + 1; j++, aux++){
printf ("%.2fX%d\t", sistema.A[ i ][ j ], aux);
}
printf ("= %.2f\t", sistema.A[ i ][ j ]);
printf ("\n");
}
printf ("\n");
break;
}
case 2:{
char nome_arquivo[100];
printf("Qual o nome do arquivo? ");
scanf("%s", nome_arquivo);
strcat(nome_arquivo, ".txt");
arquivo = fopen(nome_arquivo, "a+b");
if(arquivo == NULL){
printf("Problemas na abertura do arquivo!");
}else{
printf("Arquivo lido com sucesso!\n\n");
while(!feof(arquivo)){
EOF_ctrl = fread(&sistema, sizeof(Sistema), 1, arquivo);
if(ferror(arquivo)){
printf("\nERRO na leitura do arquivo");
}else{
if(EOF_ctrl != 0){
printf("Ordem: %d\n", sistema.ordem);
printf ("\n");
printf("Posto: %d\n", sistema.posto);
printf ("\n");
printf("Matriz: ");
for(i = 1; i <= sistema.ordem; i++){
for(j = 1; j <= sistema.ordem + 1; j++){
printf ("%.2f\t", sistema.A[ i ][ j ]);
}
printf ("\n");
printf ("\t");
}
printf ("\n");
printf("X: ");
for(i = 1; i <= sistema.ordem; i++){
printf("%.2f\n", sistema.x[ i ]);
}
printf ("\n");
printf("Y: ");
for(i = 1; i <= sistema.ordem; i++){
sistema.y[i] = sistema.A[i][sistema.ordem + 1];
printf ("%.2f\n", sistema.y[i]);
}
}
}
}
printf("Fim do arquivo!\n");
}
break;
}
case 3:{
char nome_arquivo[100];
arquivo = fopen(nome_arquivo, "a+b");
if(arquivo == NULL){
printf("Problemas na abertura do arquivo!");
}else{
printf("Arquivo criado com sucesso!\n");
}
//Zerando a parte de baixo, tornando uma matriz triangular superior
for(j = 1; j <= sistema.ordem; j++){
for(i = 1; i <= sistema.ordem; i++){