Reading semi formatted text file
| From: | Chris Steitz | Date: | Mon, 24 Dec 2001 17:12:17 +0000 |
| Subject: | Reading semi formatted text file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-78669@lists.php.net to get a copy of this message | ||
201 PNCPS FINANCIAL ACCT 10027 3 8.00- 8.50 MWF GSB 400
I have a text file with rows similar to that above. I need to read the data in the rows into an
array. fscanf likes to split the line into elements by spaces and I get
201,PNCPS,FINANCIAL,ACCT etc...
and I need results like
201,PNCPS FINANCIAL ACCT,10027 etc...
data[1]=201
data[2]=PNCPS FINANCIAL ACCT
data[3]=10027
data[4]=3
data[5]=8.00
data[6]=8.50
data[7]=MWF
data[8]=GSB 400
Can anybody provide any help on how to do this?