Hi
I wrote fllowing for reading file line by line till I get end of file . I could not run it properly. I compile in VC++ but basic syntax is C only. PLease help me out !!!!!!
Is this correct way to read file till end --------
while(fgets(string1,sizeof(string1),text) != "/0")
Code:// ACIDlg.cpp : implementation file // #include "stdafx.h" #include "ACI.h" #include "ACIDlg.h" #include "stdio.h" #include "math.h" #include "stdlib.h" #include "stdio.h" #include "iostream.h" #include "string.h" FILE *text; char string1[BUFSIZ]; char *string2; char stri[10]; void CACIDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CACIDlg) DDX_Control(pDX, IDC_LIST1, m_strrr); // DDX_Text(pDX, IDC_EDIT1, m_st); //}}AFX_DATA_MAP while(fgets(string1,sizeof(string1),text) != "/0") { //fgets(pstring1,sizeof(pstring1),text); if ((string2 = strchr(string1, '\n')) != NULL) *string2 = '\0'; m_st=string1; m_strrr.AddString(m_st); }



LinkBack URL
About LinkBacks


