Jump to content

почему-то не записывается в файл?


can4ec
 Share

Recommended Posts

Файл создается, цифра в него не записываются. Кто знает подскадите...

#include <iostream.h>

#include <stdio.h>

int main()

{

FILE *in;

in = fopen("file1.txt", "w");

cout<<"243534534";

fclose(in);

return 0;

}

Link to comment
Share on other sites

так ты при вызове cout указывай куда выводить то.

cout<< in <<"243534534";

я указал , но все равно он только создаеться но не записывается.

#include <iostream.h>

#include <stdio.h>

int main()

{

FILE *in;

in = fopen("file1.txt", "w");

cout<<in<<"243534534";

fclose(in);

return 0;

}

Link to comment
Share on other sites

Сделай так:

#include <iostream.h>#include <fstream.h>FILE *in; in = fopen("file1.txt", "w");fstream inout("file1.txt");inout << "243534534" << endl;fclose(in);

#include <iostream.h>

#include <fstream.h>

#include <stdio.h>

int main()

{

FILE *in;

in = fopen("file1.txt", "w");

fstream inout("file1.txt");

inout<<"dadsad"<<endl;

fclose(in);

return 0;

}

Показывает ошибку на строку fstream inout("file1.txt");

ошибка:cannot convert parameter 1 from 'char [10]' to 'int'

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...