473,403 Members | 2,354 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,403 software developers and data experts.

ignoring comment line on the text file.

44
hi everyone
i am reading file from text file to the input box so my problem i cant read the commented file.so if someone can help me with to ignore lines with hash i will be glad.

#8542 sinah 34 - 08 -55
Feb 7 '08 #1
2 1302
nathj
938 Expert 512MB
hi everyone
i am reading file from text file to the input box so my problem i cant read the commented file.so if someone can help me with to ignore lines with hash i will be glad.

#8542 sinah 34 - 08 -55
Hi,

Could you post the code you have so far? Then I will have a go and suggesting an alteration to do this for you.

Cheers
nathj
Feb 7 '08 #2
ogo796
44
hi People
-------------
books .txt
-------------
to sir with love
the punisher
#php Bible

this is text file that i am reading from.i read these files into an array after that i wipe the content of the file after i push the content of the file to the
text file line by line cause i want to write the specific line and sort.

so my problem is when i write bag to the text file it push all the commented file at the bottom of the file and this prevent me to read the file after the commented one so anybody help
thanks
example
$your_data = $_POST["book"]
$q=$_POST["path"];

$myArray = file($q."book.txt");

//Open registry file and wipe contents

$fp = fopen($q."book.txt", "w");

array_push($myArray,$your_data);

usort($myArray,"strnatcmp");



//Loop through the registry array

foreach ($myArray as $value)

{

//Write the sorted contents to registry line-by-line

fwrite($fp,$value);



}



// Close the registry file

fclose($fp);

please help me to ignore the commented file.
Feb 7 '08 #3

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

Similar topics

16
by: qwweeeit | last post by:
In analysing a very big application (pysol) made of almost 100 sources, I had the need to remove comments. Removing the comments which take all the line is straightforward... Instead for the...
2
by: Paul Bramscher | last post by:
What are the mechanisms to make words like a/an/the in text and varchar character fields ignored when performing SELECT and utilizing ORDER BY in SQL queries? I've done some hunting around into...
5
by: BACON | last post by:
I'm just starting the process of reorganising my modest little website and cleaning up all the HTML, and the logical place to begin was with the homepage. I made a simple little ASP.NET control...
5
by: chris_doran | last post by:
/COMMENT has been removed from the linker that comes with VS2005, and use in source code of: #pragma comment(exestr, "this is a string") gives the message: warning LNK4224: /COMMENT is no...
29
by: dbhbarton | last post by:
Had a thought that's grown on me. No idea if it's original or not- too inexperienced in programming- but I guess there's no harm floating it out there. Python wins big on readability, and...
1
by: Joe Cool | last post by:
I am attempting to add a function to an application I am working on to modify the JPEG Comment in a Jpeg image file. I can retrieve the JPEG Comment with no problem. The problem is modifying it....
1
by: ogo796 | last post by:
hi People ------------- books .txt ------------- to sir with love the punisher #php Bible this is text file that i am reading from.i read these files into an array after that i wipe...
14
by: Siv | last post by:
Hi, Just busily coding away and removed a procedure from my code and all of a sudden an error came up miles away from the location of the piece of code I removed and it relates to the XML...
39
by: polas | last post by:
Afternoon all. I was just wondering about this point - I have (generally) used // for commenting a single line in C, but from looking at code other people have written it seems many use /* */...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.