format code in file

This is a discussion on format code in file within the Linux Programming forums, part of the Platform Specific Boards category; Hi.. EDIT...DAMN... It tricked me.. :S Weel I want to format a file regarding Code: "{" and "}" so it ...

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    46

    format code in file

    Hi..

    EDIT...DAMN... It tricked me.. :S

    Weel I want to format a file regarding
    Code:
    "{" and "}"
    so it is possible to se the code easier.. I know there exist a linux-command to do this (format a C-file), but cannot remember it..
    Anyone..?
    Last edited by sniper83; 07-20-2007 at 11:30 AM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,621
    A quick search of the Web gives Artistic Style and Indent - C source beautifier. Next time, you might want to search the Web before you ask.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    May 2007
    Posts
    46
    Quote Originally Posted by laserlight View Post
    A quick search of the Web gives Artistic Style and Indent - C source beautifier. Next time, you might want to search the Web before you ask.
    Actually I did, and I still search for it.. But apparently the keywords i use must be wrong.. :/
    Thanks..

  4. #4
    Registered User
    Join Date
    May 2007
    Posts
    46
    Indent there it was...

  5. #5
    Registered User
    Join Date
    May 2007
    Posts
    46
    Damn.. A crap function.. It looks like hell now.. I'm glad i made a backup before running it.. :S Cannot recommend this method for anyony..

  6. #6
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,352
    Quote Originally Posted by sniper83 View Post
    Damn.. A crap function.. It looks like hell now.. I'm glad i made a backup before running it.. :S Cannot recommend this method for anyony..
    Ummm.. Indent has a billion options to control the style. You didn't set it up right. Don't blame the tool for your inability to use it.

  7. #7
    Registered User
    Join Date
    May 2007
    Posts
    46
    Quote Originally Posted by brewbuck View Post
    Ummm.. Indent has a billion options to control the style. You didn't set it up right. Don't blame the tool for your inability to use it.
    You are right.. Sorry, I take it back..

  8. #8
    Registered User
    Join Date
    May 2007
    Posts
    46
    Now I sure love the method.. Thanks big time kicking my ass for that comment about crap... Surely a super nice method..

  9. #9
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Does it reformat code into K&R style ?
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  10. #10
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,352
    Quote Originally Posted by abachler View Post
    Does it reformat code into K&R style ?
    By default it does something very close to the original K&R. It can be configured to match it exactly. It can be configured to do it any way you want, really.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  3. Replies: 5
    Last Post: 06-07-2007, 01:41 PM
  4. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21