Hello, I am writing this code with Borland C. The problem is that when I try to find the .txt file, I see that it hasnīt been created.Then dubugging it, I see stream=NULL. Can anyone help me?
Code:
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
#include <string.h>
#include <io.h>
#include <iostream.h>
#include <dstring.h>.
#include <stdio.h>
#include <math.h>
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
using namespace std;
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString FN;
//Text1 = Text2
FN=Edit1->Text;
Edit2->Text=FN;
//Creation of the file
FILE *stream;
stream = fopen("c:\log.txt", "w+");
fprintf(stream, "All is right");
fclose(stream);
}
//---------------------------------------------------------------------------
Thanks,