Thread: c++ help needed

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    8

    Lightbulb c++ help needed

    Hello
    I apologize for my poor english
    I'm a italian old retired, I hope to increase my mind's performances trying to resolve my problems using c++.
    I'm trying with this program to recover emails in a file processable in Excel or access.
    the program works fine recovering all emails, but the last recursive sector of any email stops at the first RETURN of the message, instead i need that the catching works until the end of the text of any email.
    Some one can help me to get what i need?
    many thanks
    Ettore
    hereunder my program
    ---------------------------------------------
    Code:
    #include <stdio.h>
    #include <string.h>
    
    main(argc, argv)
    int argc;
    char *argv[];
    {
    	char strAppo[1001];
    	char strAppo1[1001];
    	char FileOut[256];
    	int lenstr;
    	FILE *pfIn, *pfOut;
    	char *pDest;
    
    	if ((pfIn = fopen(argv[1], "r")) == NULL)
    	{
    		printf ("Errore apertura file %s", argv[1]);
    		return(-1);
    	}
    
    	sprintf(FileOut, "%s.out", argv[1]);
    
    	if ((pfOut = fopen(FileOut, "w")) == NULL)
    	{
    		printf ("Errore apertura file %s", FileOut);
    		return(-2);
    	}
    
    	while(!feof(pfIn))
    	{
    		fgets(strAppo,1000,pfIn);
    
    		pDest = strstr(strAppo, "Date:");
    
    		if (pDest != NULL)
    		{
    			strAppo1[0] = 0;
    			lenstr = strlen(pDest + 5);
    			strncpy (strAppo1, pDest + 5, lenstr - 1);
    			strAppo1[lenstr - 1] = 0;
    			fputs(strAppo1, pfOut);
    		}
    
    		pDest = strstr(strAppo, "Nome:");
    
    		if (pDest != NULL)
    		{
    			strAppo1[0] = 0;
    			lenstr = strlen(pDest + 5);
    			strncpy (strAppo1, pDest + 5, lenstr - 1);
    			strAppo1[lenstr - 1] = 0;
    			fputs("|", pfOut);
    			fputs(strAppo1, pfOut);
    		}
    
    		pDest = strstr(strAppo, "Email:");
    
    		if (pDest != NULL)
    		{
    			strAppo1[0] = 0;
    			lenstr = strlen(pDest + 6);
    			strncpy (strAppo1, pDest + 6, lenstr - 1);
    			strAppo1[lenstr - 1] = 0;
    			fputs("|", pfOut);
    			fputs(strAppo1, pfOut);
    		}
    
    		pDest = strstr(strAppo, "Cognome:");
    
    		if (pDest != NULL)
    		{
    			strAppo1[0] = 0;
    			lenstr = strlen(pDest + 8);
    			strncpy (strAppo1, pDest + 8, lenstr - 1);
    			strAppo1[lenstr - 1] = 0;
    			fputs("|", pfOut);
    			fputs(strAppo1, pfOut);
    		}
    
    		pDest = strstr(strAppo, "Messaggio:");
    
    		if (pDest != NULL)
    		{
    			strAppo1[0] = 0;
    			lenstr = strlen(pDest + 10);
    			strncpy (strAppo1, pDest + 10, lenstr - 1);
    			strAppo1[lenstr - 1] = 0;
    			fputs("|", pfOut);
    			fputs(strAppo1, pfOut);
    			fputs("\n", pfOut);
    		}
    	}
    
    	fclose(pfIn);
    	fclose(strAppo);
    
    
    	return(0);
    }

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Technically, that's not C++, it's C - in fact, the form of "main(argc, argv) int argc; char *argv[]" is decidedly OLD school. A more modern approach would use:
    Code:
    int main(int argc, char *argv[])

    Aside from that, I believe that your problem is that you are using fgets() to read one line of data, and the rest of the data is "lost" because it doesn't have the "tags" you are looking for.

    Is there an end-marker for the text of the e-mail?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    For this code:
    Code:
    	while(!feof(pfIn))
    	{
    		fgets(strAppo,1000,pfIn);
    
    		pDest = strstr(strAppo, "Date:");
    Wouldn't this be better?
    Code:
    	while(1)
    	{
    		fgets(strAppo,1000,pfIn);
    		if (feof(pfIn)) break ; 
    		pDest = strstr(strAppo, "Date:");
    How I see it (the first way it is written) is fget() can return EOF, but the record is processed anyway.

    Todd

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Todd, good point. Another way to do that is:
    Code:
    while(fgets(...) != NULL)
    as fgets returns NULL when it can't read anything more.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    8
    Hi
    i do not know if there's one end of message marker, but i think yes.
    the file is a normal email's file
    there's a header and a lot of emails one after other.
    I hope that any message are separated by a end of text character
    Ettore

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So basically, once you get to the message part, you need to read lines until you find the end of text, using further calls to fgets().

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Jan 2008
    Posts
    8
    Quote Originally Posted by matsp View Post
    So basically, once you get to the message part, you need to read lines until you find the end of text, using further calls to fgets().
    --
    Mats
    Yes to recover any email from file
    i think that i need to change the segment
    Code:
    pDest = strstr(strAppo, "Messaggio:");
    
    		if (pDest != NULL)
    		{
    			strAppo1[0] = 0;
    			lenstr = strlen(pDest + 10);
    			strncpy (strAppo1, pDest + 10, lenstr - 1);
    			strAppo1[lenstr - 1] = 0;
    			fputs("|", pfOut);
    			fputs(strAppo1, pfOut);
    			fputs("\n", pfOut);
    		}
    where
    Code:
    if (pDest != NULL)
    must be some code that instead of identifying the character return, it can identify the end of the text.
    I'm no able to write this code!!
    Ettore

  8. #8
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Can you post a small section of the email file so we can see the end-marker please?

  9. #9
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Also, this appears to be wrong:
    Code:
    strAppo1[lenstr - 1] = 0;
    I think it should be
    Code:
    strAppo1[lenstr] = 0;
    But looking at it closer, I think you can even improve it more, to this for the whole section of code:

    Code:
    		if (pDest != NULL)
    		{
    			strAppo1[0] = 0;
    			
    			strcpy (strAppo1, pDest + 10);
    			
    			fputs("|", pfOut);
    			fputs(strAppo1, pfOut);
    			fputs("\n", pfOut);
    		}
    ** unless you are removing the RETURN as well. ??

    Todd

  10. #10
    Registered User
    Join Date
    Jan 2008
    Posts
    8
    Quote Originally Posted by Todd Burch View Post
    Can you post a small section of the email file so we can see the end-marker please?
    Code:
    From [email protected]  Mon Nov 19 11:57:58 2007
    Return-Path: <[email protected]>
    Received: from localhost (localhost [127.0.0.1])
    	by localhost.localdomain (8.11.6/8.11.6) with ESMTP id lAJAvwY03874
    	for <cognomi@localhost>; Mon, 19 Nov 2007 11:57:58 +0100
    Envelope-to: [email protected]
    Delivery-date: Mon, 19 Nov 2007 05:15:42 -0500
    Received: from cognomiitaliani.org [72.29.83.102]
    	by localhost with POP3 (fetchmail-5.9.0)
    	for cognomi@localhost (single-drop); Mon, 19 Nov 2007 11:57:58 +0100 (CET)
    Received: from cognomi by pass45.dizinc.com with local (Exim 4.68)
    	(envelope-from <[email protected]>)
    	id 1Iu3fK-0003X3-BI
    	for [email protected]; Mon, 19 Nov 2007 05:15:42 -0500
    To: [email protected]
    Subject: [Segnalazione notizie]: 
    From: [email protected]
    Reply-To: [email protected]
    Message-Id: <[email protected]>
    Date: Mon, 19 Nov 2007 05:15:42 -0500
    Status: O
    X-Status: 
    X-Keywords:                  
    
    
    		Nome: paolo francesco barbaccia
    		Email: [email protected]
    		Cognome: dinastia normanna sveva,italianizzata in antiochia
      		Messaggio:   Antiochia.
    
    Nobilissima famiglia originata dalla imperiale casa Sveva. Un Corrado conte di Alba, Celano, Loreto ed Abruzzo (figlio di Federico d’Antiochia, figlio naturale dell’imperatore Federico lo Svevo), nipote e familiare di Re Manfredi, nel marzo del 1263 esercitò l’ufficio di Vicario nelle Marche, un Bartolomeo de Antiochia milite ebbe concessi da Re Federico a 1 aprile 1299 tutti i beni già appartenuti al milite Lupo de Inguardiola ribelle; un Pietro pretore di Palermo nel 1318-19 fu cancelliere del regno nel 1328; un Federico fu conte di Capizzi e gran cancelliere di Sicilia nel 1337 ed un Benedetto, milite, da Randazzo è tassato nel 1343 sotto Ludovico per un cavallo e mezzo armato.
    
    Arma: di rosso, seminato di gigli d’oro. Alias: d’argento, all’aquila spiegata di nero, coronata dello stesso.
    
     
        
    
    From [email protected]  Mon Nov 19 11:57:59 2007
    Return-Path: <[email protected]>
    Received: from localhost (localhost [127.0.0.1])
    	by localhost.localdomain (8.11.6/8.11.6) with ESMTP id lAJAvxY03877
    	for <cognomi@localhost>; Mon, 19 Nov 2007 11:57:59 +0100
    Envelope-to: [email protected]
    Delivery-date: Mon, 19 Nov 2007 05:21:08 -0500
    Received: from cognomiitaliani.org [72.29.83.102]
    	by localhost with POP3 (fetchmail-5.9.0)
    	for cognomi@localhost (single-drop); Mon, 19 Nov 2007 11:57:59 +0100 (CET)
    Received: from cognomi by pass45.dizinc.com with local (Exim 4.68)
    	(envelope-from <[email protected]>)
    	id 1Iu3ka-0003iW-PX
    	for [email protected]; Mon, 19 Nov 2007 05:21:08 -0500
    To: [email protected]
    Subject: [Segnalazione notizie]: 
    From: [email protected]
    Reply-To: [email protected]
    Message-Id: <[email protected]>
    Date: Mon, 19 Nov 2007 05:21:08 -0500
    Status: O
    X-Status: 
    X-Keywords:                  
    
    
    		Nome: paolo francesco barbaccia
    		Email: [email protected]
    		Cognome: bartolomeo
      		Messaggio:   Bartolomeo.
    
    Un Simone di Bartolomeo fu pretore di Palermo 1414-15; un Leonardo dottore in ambo le leggi e protonotaro del regno ebbe in enfiteusi il tenimento di terre nominato la Tarbia (Trabia), che nell’anno 1444 ebbe confermato dal viceré. A lui succedette Narduccio (Leonardo) suo figlio, che fu senatore di Palermo nell’anno 1475 ed ebbe un’unica figlia, che sposò il dottor Blasco Lancea (per Lanza) che, nell’anno 1509, ottenne infeudazione del territorio della Trabia.
    
    Arma: d’oro, al castello merlato di tre pezzi di nero, accostato da due rose di rosso.
    
      
        
    
    From [email protected]  Mon Nov 19 11:57:59 2007
    Return-Path: <[email protected]>
    Received: from localhost (localhost [127.0.0.1])
    	by localhost.localdomain (8.11.6/8.11.6) with ESMTP id lAJAvxY03880
    	for <cognomi@localhost>; Mon, 19 Nov 2007 11:57:59 +0100
    Envelope-to: [email protected]
    Delivery-date: Mon, 19 Nov 2007 05:23:41 -0500
    Received: from cognomiitaliani.org [72.29.83.102]
    	by localhost with POP3 (fetchmail-5.9.0)
    	for cognomi@localhost (single-drop); Mon, 19 Nov 2007 11:57:59 +0100 (CET)
    Received: from cognomi by pass45.dizinc.com with local (Exim 4.68)
    	(envelope-from <[email protected]>)
    	id 1Iu3n3-0003vD-QM
    	for [email protected]; Mon, 19 Nov 2007 05:23:41 -0500
    To: [email protected]
    Subject: [Segnalazione notizie]: 
    From: [email protected]
    Reply-To: [email protected]
    Message-Id: <[email protected]>
    Date: Mon, 19 Nov 2007 05:23:41 -0500
    Status: O
    X-Status: 
    X-Keywords:                  
    
    
    		Nome: paolo francesco barbaccia
    		Email: [email protected]
    		Cognome: Puleio  o Pulejo.
      		Messaggio:  Puleio  o Pulejo.
    
    Godette nobiltà in Messina, trovando annotato nella mastra nobile del Mollica un Giovan Simone e un Giuseppe. Troviamo pure detta famiglia in Santa Lucia, dove un Tommaso tenne la carica di proconservatore nel 1726.
    
    Arma: d’azzurro, al leone d’oro, impugnante con le zampe anteriori un ramo di puleggio di verde, fiorito di rosso.
    
    
        
    
    From [email protected]  Mon Nov 19 11:58:00 2007
    Return-Path: <[email protected]>
    Received: from localhost (localhost [127.0.0.1])
    	by localhost.localdomain (8.11.6/8.11.6) with ESMTP id lAJAw0Y03883
    	for <cognomi@localhost>; Mon, 19 Nov 2007 11:58:00 +0100
    Envelope-to: [email protected]
    Delivery-date: Mon, 19 Nov 2007 05:28:24 -0500
    Received: from cognomiitaliani.org [72.29.83.102]
    	by localhost with POP3 (fetchmail-5.9.0)
    	for cognomi@localhost (single-drop); Mon, 19 Nov 2007 11:58:00 +0100 (CET)
    Received: from cognomi by pass45.dizinc.com with local (Exim 4.68)
    	(envelope-from <[email protected]>)
    	id 1Iu3rc-00045s-FM
    	for [email protected]; Mon, 19 Nov 2007 05:28:24 -0500
    To: [email protected]
    Subject: [Segnalazione notizie]: 
    From: [email protected]
    Reply-To: [email protected]
    Message-Id: <[email protected]>
    Date: Mon, 19 Nov 2007 05:28:24 -0500
    Status: O
    X-Status: 
    X-Keywords:                  
    
    
    		Nome: paolo francesco barbaccia
    		Email: [email protected]
    		Cognome: Giudice (del)  o Lo Giudice.
      		Messaggio:  Giudice (del)  o Lo Giudice.
    
    Originaria di Napoli secondo alcuni autori, di Genova secondo altri; godette nobiltà in Messina dal secolo XIII al XVII, in Palermo, in Marsala ed altrove e possedette le baronie di Gualtieri e di Sollazzo, la tonnara di Magasinazzi, ecc. Un Bartolomeo fu giudice di Messina nel 1256; un Giovanni, al dir del Minutolo, fu cavaliere e cameriere di Re Alfonso e il figlio Antonio maestro razionale del regno; un Giovanni Antonio, da Marsala, con privilegio dato a 6 febbraio 1535 esecutoriato a 12 gennaro 1536, ottenne la concessione del titolo di regio cavaliere e delle armi gentilizie; un Bernardo fu annotato nella mastra nobile del Mollica; un Giovan Francesco fu senatore di Messina nel 1607 e nel 1619 e si vuole che sia stato uno dei fondatori dell’ordine militare della Stella; un Vincenzo, con privilegio del 27 ottobre 1653 esecutoriato a 24 settembre 1659, ottenne la concessione del titolo di Don e di quello di barone di S. Chiara; un Antonino fu giudice pretoriano di Palermo nel 1701, con privilegio dato a 18 luglio esecutoriato a 1 settembre 1704, venne nominato giudice del tribunale del Concistoro e, con privilegio del 24 novembre 1707, di quello della Gran Corte Civile.
    
    Arma: inquartato di rosso e di nero, alla croce spinata d’argento, attraversante sul tutto.
        
    
    From [email protected]  Mon Nov 19 11:58:01 2007
    Return-Path: <[email protected]>
    Received: from localhost (localhost [127.0.0.1])
    	by localhost.localdomain (8.11.6/8.11.6) with ESMTP id lAJAw0Y03891
    	for <cognomi@localhost>; Mon, 19 Nov 2007 11:58:00 +0100
    Envelope-to: [email protected]
    Delivery-date: Mon, 19 Nov 2007 05:31:36 -0500
    Received: from cognomiitaliani.org [72.29.83.102]
    	by localhost with POP3 (fetchmail-5.9.0)
    	for cognomi@localhost (single-drop); Mon, 19 Nov 2007 11:58:00 +0100 (CET)
    Received: from cognomi by pass45.dizinc.com with local (Exim 4.68)
    	(envelope-from <[email protected]>)
    	id 1Iu3ui-0004Do-LQ
    	for [email protected]; Mon, 19 Nov 2007 05:31:36 -0500
    To: [email protected]
    Subject: [Segnalazione notizie]: 
    From: [email protected]
    Reply-To: [email protected]
    Message-Id: <[email protected]>
    Date: Mon, 19 Nov 2007 05:31:36 -0500
    Status: O
    X-Status: 
    X-Keywords:                  
    
    
    		Nome: paolo francesco barbaccia
    		Email: [email protected]
    		Cognome: Vaccaro.
      		Messaggio: Vaccaro.
    
    Notiamo: un Pino, da Malta, che, a 20 febbraio 1397, ottenne concessione del feudo Aquilea; un Inigo, da Malta, milite, consigliere regio, che ottenne, a 24 febbraio 1397, il feudo Beniarad o Venerando e fu capitano sostituto in Malta e Gozzo nel 1403; un Giovanni, che fu castellano della torre di Troina nell’anno 1443; un Tommaso, che fu senatore in Messina nell’anno 1451-52; un Giacomo castellano di Troina nell’anno 1479; un Carmelo, che, a 5 maggio 1811, fu aggregato al ceto nobile di Randazzo.
    
    Arma: di rosso, alla vacca passante d’oro.
    This above is a bit of the file containing 5 emails

  11. #11
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    I would do this:

    When you detect "Messaggio:", set a status flag to indicate your are "in a message".

    At the top of your loop, just after the fgets(), test to see if you are "in a message". If you are,
    the look for "From " in column 1. If you find it, turn off your status flag. Otherwise, perform the same logic you are already performing for saving the message text and then continue.


    Oh, and it appears you are removing the RETURN, so you can overwrite it after the strcpy().

    Todd

  12. #12
    Registered User
    Join Date
    Jan 2008
    Posts
    8
    Code:
    Nome: paolo francesco barbaccia
    		Email: [email protected]
    		Cognome: Vaccaro.
      		Messaggio: Vaccaro.
    
    Notiamo: un Pino, da Malta, che, a 20 febbraio 1397, ottenne concessione del feudo Aquilea; un Inigo, da Malta, milite, consigliere regio, che ottenne, a 24 febbraio 1397, il feudo Beniarad o Venerando e fu capitano sostituto in Malta e Gozzo nel 1403; un Giovanni, che fu castellano della torre di Troina nell’anno 1443; un Tommaso, che fu senatore in Messina nell’anno 1451-52; un Giacomo castellano di Troina nell’anno 1479; un Carmelo, che, a 5 maggio 1811, fu aggregato al ceto nobile di Randazzo.
    
    Arma: di rosso, alla vacca passante d’oro.
    this is the last message, in this message i need to extract the fields = Nome:, Email:, Cognome:, Messaggio:
    the program extract all fields, but the file Messaggio: is truncated and i need to fix this problem.

  13. #13
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    I ran it, and the output file looks correct. What is wrong with it?
    Code:
     Mon, 19 Nov 2007 05:15:42 -0500| paolo francesco barbaccia| [email protected]| dinastia normanna sveva,italianizzata in antiochia|   Antiochia.
     Mon, 19 Nov 2007 05:21:08 -0500| paolo francesco barbaccia| [email protected]| bartolomeo|   Bartolomeo.
     Mon, 19 Nov 2007 05:23:41 -0500| paolo francesco barbaccia| [email protected]| Puleio  o Pulejo.|  Puleio  o Pulejo.
     Mon, 19 Nov 2007 05:28:24 -0500| paolo francesco barbaccia| [email protected]| Giudice (del)  o Lo Giudice.|  Giudice (del)  o Lo Giudice.
     Mon, 19 Nov 2007 05:31:36 -0500| paolo francesco barbaccia| [email protected]| Vaccaro.| Vaccaro.
    (I say "right" - but there is no message body. Did you want that?)

  14. #14
    Registered User
    Join Date
    Jan 2008
    Posts
    8
    look at the second message in example:
    the Messaggio: report
    Bartolomeo.
    but the text should be correctly:
    Bartolomeo.
    Un Simone di Bartolomeo fu pretore di Palermo 1414-15; un Leonardo dottore in ambo le leggi e protonotaro del regno ebbe in enfiteusi il tenimento di terre nominato la Tarbia (Trabia), che nell’anno 1444 ebbe confermato dal vicer&#233;. A lui succedette Narduccio (Leonardo) suo figlio, che fu senatore di Palermo nell’anno 1475 ed ebbe un’unica figlia, che spos&#242; il dottor Blasco Lancea (per Lanza) che, nell’anno 1509, ottenne infeudazione del territorio della Trabia.

    Arma: d’oro, al castello merlato di tre pezzi di nero, accostato da due rose di rosso.
    the issue is this truncation of message at the first RETURN

  15. #15
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    See if this is what you want.

    Code:
    #include <stdio.h>
    #include <string.h>
    
    int main (int argc, const char * argv[]) {
    	char strAppo[1001];
    	char strAppo1[1001];
    	char FileOut[256];
    	int lenstr;
    	int in_message = 0 ;  // initialize to false 
    	FILE *pfIn, *pfOut;
    	char *pDest;
    
    	if ((pfIn = fopen(argv[1], "r")) == NULL)
    	{
    		printf ("Errore apertura file &#37;s", argv[1]);
    		return(-1);
    	}
    
    	sprintf(FileOut, "%sout.txt", argv[1]);
    
    	if ((pfOut = fopen(FileOut, "w")) == NULL)
    	{
    		printf ("Errore apertura file %s", FileOut);
    		return(-2);
    	}
    
    	while(!feof(pfIn))
    	{
    		fgets(strAppo,1000,pfIn);
    
    		if (in_message) {
    			if (!strncmp(strAppo,"From ",5)) 
    			{
    				in_message = 0 ;  // turn off the flag - end of message 
    				fputs("\n", pfOut);
    			}
    				
    			else 
    			{ 
    				pDest = strAppo ; 
    				strAppo1[0] = 0;
    				lenstr = strlen(pDest);
    				strcpy (strAppo1, strAppo) ; 
    				strAppo1[strlen(strAppo1) - 1] = 0;
    				fputs(strAppo1, pfOut);
    				continue ; 
    			}
    		}
    
    		pDest = strstr(strAppo, "Date:");
    
    		if (pDest != NULL)
    		{
    			strAppo1[0] = 0;
    			lenstr = strlen(pDest + 5);
    			strncpy (strAppo1, pDest + 5, lenstr - 1);
    			strAppo1[lenstr - 1] = 0;
    			fputs(strAppo1, pfOut);
    		}
    
    		pDest = strstr(strAppo, "Nome:");
    
    		if (pDest != NULL)
    		{
    			strAppo1[0] = 0;
    			lenstr = strlen(pDest + 5);
    			strncpy (strAppo1, pDest + 5, lenstr - 1);
    			strAppo1[lenstr - 1] = 0;
    			fputs("|", pfOut);
    			fputs(strAppo1, pfOut);
    		}
    
    		pDest = strstr(strAppo, "Email:");
    
    		if (pDest != NULL)
    		{
    			strAppo1[0] = 0;
    			lenstr = strlen(pDest + 6);
    			strncpy (strAppo1, pDest + 6, lenstr - 1);
    			strAppo1[lenstr - 1] = 0;
    			fputs("|", pfOut);
    			fputs(strAppo1, pfOut);
    		}
    
    		pDest = strstr(strAppo, "Cognome:");
    
    		if (pDest != NULL)
    		{
    			strAppo1[0] = 0;
    			lenstr = strlen(pDest + 8);
    			strncpy (strAppo1, pDest + 8, lenstr - 1);
    			strAppo1[lenstr - 1] = 0;
    			fputs("|", pfOut);
    			fputs(strAppo1, pfOut);
    		}
    
    		pDest = strstr(strAppo, "Messaggio:");
    
    		if (pDest != NULL)
    		{
    			in_message = 1 ; // set to true 
    			strAppo1[0] = 0;
    			lenstr = strlen(pDest + 10);
    			strncpy (strAppo1, pDest + 10, lenstr - 1);
    			strAppo1[lenstr - 1] = 0;
    			fputs("|", pfOut);
    			fputs(strAppo1, pfOut);
    			fputs("|", pfOut);
    		}
    	}
    
    	fclose(pfIn);
    	fclose(pfOut);
    	return(0);
    }
    Last edited by Dino; 01-18-2008 at 12:06 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. free needed or not?
    By quantt in forum Linux Programming
    Replies: 3
    Last Post: 06-25-2009, 09:32 AM
  2. C Programmers needed for Direct Hire positions
    By canefan in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 09-24-2008, 11:55 AM
  3. lock needed in this scenario?
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 05-25-2008, 07:22 AM
  4. C++ help needed
    By Enkindu in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 08-31-2004, 11:24 PM
  5. semi-colon - where is it needed
    By kes103 in forum C++ Programming
    Replies: 8
    Last Post: 09-12-2003, 05:24 PM