Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare

Status
Not open for further replies.

mayu03

Programmer
Oct 3, 2003
91
0
0
US
I am trying to compare first byte of heading. What am I doing incorrect? My compiler give me error can't compare
In my process I am open a file then read line, from a line take first 4 bit and then compare.
int lineCount=0;
do
{inFile.getline(inBuffer,'~');//sizeof(inBuffer));
char heading[4];
if ((strcmp(heading[0], "S"))==0)
{cout<<heading[0];}
lineCount++;
}while(!inFile.eof());
 
First impression,
I guess this line has problems:
if ((strcmp(heading[0], &quot;S&quot;))==0)
change to
if ((strcmp(heading, &quot;S&quot;))==0)
or to
if (heading[0] == 'S')



Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top