473,387 Members | 1,578 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,387 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 1300
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.