473,395 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

supplied argument is not a valid stream resource

Hi i am doing a project in php that has to read the particular text from the file .
I am still unable to get the source of error.
what all it mentions is this message.

"supplied argument is not a valid stream resource"
This error on which it is giving me an error is marked in the code


Here is the sample source code that i am working on.
I even have tried changing the permissions for this. But that solution is also not worth.
Expand|Select|Wrap|Line Numbers
  1. --------------------------------------------------------------------------------------------
  2. $filename="1_testing_clip.rm";
  3. $fileStream=@fopen("./temp/".$filename,"rb");
  4. while(!feof($fileStream))
  5.     {
  6.         $char=fgetc($fileStream);
  7.         if(ord($char)>=32 && ord($char)<=127)
  8.             {
  9.             echo $char;
  10.             if($char=='T' || $char=='A' || $char=='C' || $char=='D' || $char=='K' || $char=='U')
  11.                 {
  12.                 parse($char);
  13.                 }
  14.             $char="";
  15.             }
  16.     }
  17. fclose($fileStream);
  18.  
  19. function parse($charValue)
  20. {
  21. switch($charValue)
  22.     {
  23.     case 'T':
  24.         {
  25.             echo "T called";
  26.             for($m=1;$m<6;$m++)
  27.                 {
  28.                       -----------------------------------
  29.                       |    $character=fgetc($fileStream);  |
  30.                       -----------------------------------
  31.                     $Title=$Title.$character;
  32.                 }
  33.             if(strcmp($Title,"Title:")==0)
  34.                 {
  35.                     echo "String is equal";
  36.                 }
  37.             break;
  38.         }
  39.                 :
  40.                 :
  41.                 :
  42.                 :
  43. ---------------------------------------------------------------------------------------------------------
  44.  
[Please use CODE tags when posting source code. Thanks! --pbmods]
Jun 19 '07 #1
3 8670
pbmods
5,821 Expert 4TB
Heya, varun aggarwal.

Expand|Select|Wrap|Line Numbers
  1. $fileStream=@fopen("./temp/".$filename,"rb");
  2.  
Try removing the '@' from in front of your fopen() to see what kind of an error it's generating.
Jun 19 '07 #2
Even removing the @ doesnt effect the code
Jun 21 '07 #3
ronnil
134 Expert 100+
try putting

Expand|Select|Wrap|Line Numbers
  1. $char=fgetc($fileStream);
in your while statement instead of !feof($filestream)
Jun 21 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Burton Figg | last post by:
Before I get in trouble, I have searched extensively for this one, in the PHP Docs, online etc. I have a simple page: <?php $un="jim"; $pw="jim"; $db="localhost";
6
by: aa | last post by:
I use the following fragment of code to output datf from MySQL: ====================================================== $chan = mysql_connect ($db_host, $username, $password); mysql_select_db...
5
by: gp | last post by:
i am implementing Iterator in a class, I have pretty much copied the code from php.net on Object Iteration. Adding all the normal methods for the task...rewind, current, next, etc. I was...
4
by: Ryanlawrence1 | last post by:
Heya, I get these 2 errors: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/themepar/public_html/changepass.php on line 20 You have not entered all the...
2
by: techjohnny | last post by:
Error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/jplane/certcent/phpweb/quiz/index.php on line 20 Warning: mysql_num_rows(): supplied argument is...
1
by: lsmamadele | last post by:
I am getting the following error messages in my search: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mamadele/public_html/BESTPLAYS/search.php on...
11
by: Breana | last post by:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/breana/public_html/category.php on line 88 ------------------------------------------- It does this...
2
by: yogitha | last post by:
For the below code i am getting an error like : --------------------------------------------------------------- Warning: fread(): supplied argument is not a valid stream resource in...
2
by: perhapscwk | last post by:
When I run my site from localhost, no error, but when I move it to webhosting, it show below error, why? Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.