How to write in txt file using C by Eclipse (typing by console) -


i trying find answer in internet pages, @ end tried here , found answer similar doesn't satisfy @ question

here answers how write text writing in constant, doesn't allows whrite console

im novice in programming world apologize if it's ordinary question. in addition, apollogize english skills too.

thanks in advance.

  #include "modificator.h"      int main(void) {         editfile();         return 0;     }      void editfile() {         file* f;         cadena cad, res;  //"cadena array of char"          printf("write access rout file required: \n");         scanf("%s", cad);          f = fopen(cad, "w");          if (f == null) {             printf("wrong opening file\n");         }         const char *text = scanf("%s", res);             fprintf(f, "some text: %s\n", text);          fclose(f);     } 

const char *text = scanf("%s", res); 

no, no, no. scanf() returns value of int type

int chk = scanf("%s", res); // beware buffer overflows if (chk == 1) {     fprintf(f, "some text: %s\n", res); } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -