|
Posted by juicy on 11/18/57 11:43
I done a program to read text file, where content is
#Header#
name: Juicy
age: 25
@Header@
#Text#
user text here
@Text@
#End#
tel
fax
@End@
eof
And I read the text file
$filename = "/usr/local/file/rpt.txt";
$fp = fopen($filename, 'r');
$content = fgets($fp);
while(strcmp($content,"@End@")<>0) {
$content = fgets($fp);
if(strcmp($content, "#Text#")==0){ //not match
$strPretext .= $content;
}//end if
//end while
I should get the data from #Text# until one line before @End@, but I get
nothing, I found that the strcmp for #Text# always not match when it read
through whole file.
I cant find out what goes wrong. Please advise.
Thanks.
[Back to original message]
|