satelit Posted July 9, 2007 Share Posted July 9, 2007 Vreau sa fac un program in C care sa creeze un fisier txt si sa imi puna informatia pe coloane nu pe linii.Eu am facut unul simplu care scrie un string pe linii :char msg[]="salut";FILE* f = fopen("TEST.txt", "w");for (int i=0;i<10;i++) {fwrite(msg, strlen(msg), 1, f); } fclose(f);Acest program creeaza un fisier TEST.txt si scrie de 9 ori salut ,dar le scrie pe o linie,eu vreau sa-mi scrie pe o coloana.Daca vreti sa ma ajutati si pe mine.Va multumesc Link to comment Share on other sites More sharing options...
ghimpe-- Posted July 9, 2007 Share Posted July 9, 2007 Daca ii dai new line merge?? :smt017 Link to comment Share on other sites More sharing options...
satelit Posted July 9, 2007 Author Share Posted July 9, 2007 Cu newline nu merge,eu programul vreau sa-l fac in c++builder si nu toate functiile din c/c++ sunt compatibile cu c++builder.O varianta ar fi cu array dar nu prea stiu sa-l implementez. Link to comment Share on other sites More sharing options...
Cristiano Posted July 10, 2007 Share Posted July 10, 2007 Adauga un '\n' de fiecare data cand trebuie sa treaca la o noua linie. Link to comment Share on other sites More sharing options...
satelit Posted July 10, 2007 Author Share Posted July 10, 2007 Am reusit cu "\n".Multumesc Link to comment Share on other sites More sharing options...
ghimpe-- Posted July 10, 2007 Share Posted July 10, 2007 Am reusit cu "\n".MultumescPai la asta m-am referit si eu, am crezut ca sti ca "\n" e new line... :smt003 Link to comment Share on other sites More sharing options...
radue Posted July 10, 2007 Share Posted July 10, 2007 "\n" parca reprezinta "caracterul" care delimiteaza sfarsitul unui rand de inceputul celuilalt. Deci el nu inseamna "new line" ci "end of line". :smt003 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.