Bonjour j'aimerais créer un petit programme qui lit un fichier test.txt et qui me renvoie ca dans un StringGrid.

ma ligne 0 -> 1 ère ligne StringGrid
ma ligne 1 -> 2 ème ligne StringGrid
...

Voici mon code :

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
#include <stdio.h>
#include "ufmMain.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

FILE * monCanal = NULL; // Déclaration et initialisation du canal
char cData[100] = ""; // Variable char C pour la gestion du texte

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::buEcritureClick(TObject *Sender)
{
// Lorsque l'utilisateur clique sur le bouton Ecrire dans le fichier *.txt


monCanal = fopen("test_lignes.txt","r"); // Ouverture du canal de communication

char c[100] = "";
int i;

while(feof(monCanal))
{
i = 0;
fgets(c,1000,monCanal);

if(fgets(c,1000,monCanal) == '\n')
{
StringGrid1->Cells[0][i + 1];
}
}
StringGrid1->Cells[0][i] = c;
fclose(monCanal);
//--------------------------------------------------------------------------

Je ne comprends pas ce qui ne fonctionne pas. Merci de votre aide.