Thread: Identifiers in text file

  1. #1
    Unregistered
    Guest

    Identifiers in text file

    If you have seen my previous posts you will know that I'm desperately trying to write a program that cross references identifers found in a source file with the line number they occur on. I would like to know if there is an easier way to select the words that are identifiers than looking at each word to see if it is a comment, or a literal, or a keyword, or a filename etc without having to code a function to do each of these things. At the moment the only way I can think of is to write very specific code for each check. eg - for a comment I would have to see if the word started with // or */, for a literal I would have to see if it was in "", ' ' etc etc. If there is an easier way that you know of, I would really like to hear it.

    Thanks in advance!

  2. #2
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    for a comment I would have to see if the word started with // or */
    Um, multi-line comments start with /*, not */

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  4. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM
  5. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM