Thread: taking something out of my big buffer

  1. #1
    Registered User
    Join Date
    Dec 2004
    Location
    The Netherlands
    Posts
    91

    taking something out of my big buffer

    hi,
    I want to printf() every anime name on animesuki.com in my console window.

    I have opened a socket now and I am receiving the source with buffer[1024]. The source is very big and I want to strip everything away except the name of the anime.

    for example, the name of the anime is shown in this line;
    Code:
    <td class="bb_m" nowrap="nowrap"><a href="/details.php/13162.html" title="Show Alternative Links"><img src="/images/px.gif" class="img_an" alt="" /></a>&nbsp;<a target="_blank" href="http://a.scarywater.net/spork/">Iriya no Sora, UFO no Natsu <b>4</b></a> - <small><b>DVD</b> version</small></td>
    anyone have any idea how to remove everything except "Iriya no Sora" ?

    thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Well
    p = strstr( buff, "<a target" );
    Gets you to the start of <a target="_blank" href="http://a.scarywater.net/spork/">Iriya no Sora

    p = strchr ( p, '>' );
    gets you to the letter just before Iriya no Sora
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Dec 2004
    Location
    The Netherlands
    Posts
    91
    hah! so easily,

    thanks Salem

  4. #4
    Registered User
    Join Date
    Dec 2004
    Location
    The Netherlands
    Posts
    91
    hey it seems that i have a problem here, hmm how should i explain this,
    let's say, the whole pagesource size is 10.240, my buffer is 1024, now there is a big chance that the buffer cuts something where i find the name from, in two. i mean , if i am searching for this: _+_^_+_ , there is a big chance that the buffer cuts it in two ( _+_ and ^_+_ )
    is there a better way, or can I do something like
    Code:
    recv (sock, buf, '\n', 0)
    to get every new line in a new buffer?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multithreading (flag stopping a thread, ring buffer) volatile
    By ShwangShwing in forum C Programming
    Replies: 3
    Last Post: 05-19-2009, 07:27 AM
  2. Print out a buffer
    By SwarfEye in forum C Programming
    Replies: 4
    Last Post: 09-08-2006, 09:32 AM
  3. Having Buffer Problems With Overlapped I/O --
    By Sargera in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 04:46 PM
  4. fgets
    By stautze in forum C Programming
    Replies: 14
    Last Post: 03-17-2003, 08:28 PM
  5. Console Screen Buffer
    By GaPe in forum Windows Programming
    Replies: 0
    Last Post: 02-06-2003, 05:15 AM