473,602 Members | 2,846 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ignoring comment line on the text file.

44 New Member
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 1309
nathj
938 Recognized Expert Contributor
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 New Member
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.t xt");

//Open registry file and wipe contents

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

array_push($myA rray,$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,$val ue);



}



// 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
2288
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 embedded comments I used the tokenize module. To my surprise the analysed output is different from the input (the last tuple element should exactly replicate the input line) The error comes out in correspondance of a triple string.
2
2365
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 documentation on character sets (but they are geared mainly at character-by-character rules) and saw some reference to string collating and stop words -- but not seen any of this all put together. Thanks for any assistance,
5
5797
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 that I can drop into the beginning of any page and it will generate HTML to display my logo, a link, and (optionally) a quote of the day, all of which will be horizontally centered at the top of the page by my default stylesheet. For the main page,...
5
4940
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 longer supported; ignored and doesn't put the string in the exe file.
29
2335
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 there's no doubt that context- dependent text formatting in IDEs (keywords, strings, comments etc) is a massive help too, therefore benefitting development and maintenance. This idea is in a similar vein, especially for when scripts grow large.
1
3240
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. I have the contents of a Jpeg loaded into an Image object, _Image, using the Image.FromFile method. I convert the Text property of a TextBox to a byte array with code
1
1156
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 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.
14
3060
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 comment inserted at the top of the procedure. I had this happen once before and I couldn't fathom why it was complaining, the XML comment is like this:
39
2857
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 /* */ (which I only use if my comment will be over multiple lines) - does one way have any advantages over the other, or is the style exactly that, a question of style? Cheers, Nick
0
7993
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7920
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5440
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3900
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2418
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.