www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/09/17:25:16

Message-ID: <364778A4.86092F30@geocities.com>
From: Sahab Yazdani <sahaby AT geocities DOT com>
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Parsing...
Lines: 46
Date: Mon, 09 Nov 1998 17:20:04 -0600
NNTP-Posting-Host: 209.148.143.218
X-Complaints-To: abuse AT sprint DOT ca
X-Trace: HME2.newscontent-01.sprint.ca 910649972 209.148.143.218 (Mon, 09 Nov 1998 17:19:32 EDT)
NNTP-Posting-Date: Mon, 09 Nov 1998 17:19:32 EDT
Organization: Sprint Canada Inc.
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

OK heres my dilema:  I want a method for reducing this string 

#include <stdio.h>

to this string

stdio.h

how do I go about doing this?  So far my code looks like this:

void Function() {
	char buffer[80];
	char *parse_string;
	
	[SNIP - UnInportant]
	[Back to imortant parts]

	// Assuming that the input is #include <%s> or #include "%s"
	parse_string = strtok( buffer, " " ); // Burn "#include"
	parse_string = strtok( NULL, " " ); // Now parse_string has "<%s>"
	
	parse_string++; // Burn '<'
	strncpy ( temp, parse_string, strlen ( parse_string ) - 1 );
	[SNIP - Unimportant Again...]
}

Now this function does a pretty good job, except for the fact that temp
contains what I want plus some garbage that it outputs for me...

Can somebody help me with this?

BTW if you are wondering why I would want to start parsing C/C++ files,
I'm doing it because I want to start developing a Source Browser for
DJGPP (failing to find one that matched the capabillities of Watcom
Source Browser, my brother suggested that I write my own... and here I
am ).

P.S.  No I do not have too much time on my hands...
-- 
**********************************************************************
* Sahab Yazdani              *    Let the Dragon ride again on the   *
* Thornhill Secondary School *     winds of Time - Wheel of Time     *
**********************************************************************
* http://www.geocities.com/TimesSquare/Bunker/8994/index.html        *
* Click the link to visit my portion of The Neverhood                *
**********************************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019