The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
make multiple line containing a pattern into single line VTAWKVT Shell Programming and Scripting 10 08-07-2008 06:54 AM
Multi-line output to single line LinuxRacr Shell Programming and Scripting 7 02-26-2008 06:05 AM
sed/awk to insert comment at defined line number homefp Shell Programming and Scripting 8 01-18-2008 12:14 PM
Trying to remove single character from a line Iz3k34l UNIX for Dummies Questions & Answers 5 07-07-2007 10:29 AM
Need to add a comment line in a text file orakhan Shell Programming and Scripting 2 09-22-2005 05:36 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-08-2006
Registered User
 

Join Date: Apr 2006
Posts: 2
remove single-line comment

Does anyone knows how to write a program to remove single-line comment in C program?

that means it don't read anything behind //
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-08-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,861
Code:
sed 's#\/\/.*##g' myfile.c
Is that what you mean?
Reply With Quote
  #3 (permalink)  
Old 04-09-2006
Registered User
 

Join Date: Apr 2006
Posts: 2
oh
i mean that if i key in //
it ignore the string behind it.
for example
when i type
/bin/ls() // This is a comment
it will execute /bin/ls and ignore everything behind this line
Reply With Quote
  #4 (permalink)  
Old 04-09-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,861
That line of code removes C comments (of the form // ) from C source files.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:27 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0