daca esti sub linux un "man fgets" te-ar lamuri ... altfel {
#include <stdio.h>
#include <string.h>
#define FI "text.in"
#define FO "text.out"
#define MAX 4097
char linie_de_text[MAX];
void citire()
{
FILE *fin;
fin = fopen(FI,"r");
// citesti linia
// atentie ca iti pune \n la sfarsit
fgets( linie_de_text, MAX-1, fin);
// acum scapam de \n
linie_de_text[strlen(linie_de_text)-1] = 0;
fclose(fin);
}
void scrie()
{
FILE *fout;
fout = fopen(FO,"w");
fprintf(fout,"%s\n",linie_de_text);
fclose(fout);
}
int main()
{
citire();
// ...
scrie();
return 0;
}
}