searching text in a file

This is a discussion on searching text in a file within the C Programming forums, part of the General Programming Boards category; Hello, I want to search for a *.mp3 file after the <body> tag in a html file. I am trying ...

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    13

    searching text in a file

    Hello,

    I want to search for a *.mp3 file after the <body> tag in a html file.
    I am trying to do this using C.

    What is the best way to do this?
    Can somebody help me out?

    Thank you

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    Like, pattern matching?

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    13
    i dont know th file name, i just know it is *.mp3 file and i want to list all the mp3 files in the HTML document

  4. #4
    #include<xErath.h> xErath's Avatar
    Join Date
    Jun 2004
    Posts
    722
    But are those mp3 listed as anchors ? or what?
    Maybe you could:
    • Load all content of file to a string (don't forget the terminating 0).
    • iterate through the string and search for the "<a" If found, you enter a new state/cicle.
      • iterate through the string until you find a:
      • a) "href=" -> read the name of the file between the "..." or if there aren't " read until the 1 whitespace. Continue main cicle
      • b) ">" -> ignore that tag - continue main cicle
    Last edited by xErath; 07-05-2005 at 02:17 AM.

  5. #5
    Registered User
    Join Date
    Mar 2005
    Posts
    37
    hey,


    If you are doing it in C its good. But there are many script languages which can be used and gonne be much more easier. Try using perl. Its gonne be very easy and its ment for that. (pattern matching.)

    However trying it out on C will enhance ur C knowledge.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Searching a text file for double quotation marks "
    By willie in forum C Programming
    Replies: 4
    Last Post: 11-23-2008, 01:00 PM
  2. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 01:59 PM
  3. Read word from text file (It is an essay)
    By forfor in forum C Programming
    Replies: 7
    Last Post: 05-08-2003, 11:45 AM
  4. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM

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