CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

strstr works on 3,225 but on 3.245 not

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest
Guest







strstr works on 3,225 but on 3.245 not
PostPosted: Sat Mar 18, 2006 8:28 am     Reply with quote

Hi,
Anybody now why this code work compiled with 3.225, but 3.245 not !?!
I use this on 18F2620, Mplab 7.31


Code:
   

    strcpy(buff1, "ende");
    printf("Start \r");

    while( TRUE ){

        gets(buffer);
        if( strstr(buffer, buff1) )
            break;
       
        printf("---> %s\r", buffer);

    }   
    printf("Ende Test\r");
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Mar 18, 2006 12:50 pm     Reply with quote

Quote:

Anybody now why this code work compiled with 3.225, but 3.245 not !?!
I use this on 18F2620, Mplab 7.31

You didn't post a test program so I made one. I compiled it with
PCH vs. 3.245.

I don't have your hardware so I used the MPLAB simulator (vs. 7.20).
I commented out the gets() line, and instead I loaded the "buffer"
array with a string.

The following program works OK in the MPLAB simulator using
"UART1" to display RS-232 output in the Output Window.
It displays this:
Quote:

Start
Ende Test


Code:
#include <18F2620.H>
#fuses XT, NOWDT,  NOPROTECT, BROWNOUT, PUT, NOLVP   
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#include <string.h>

void main()
{
char buff1[50];
char buffer[50];

strcpy(buff1, "ende");

strcpy(buffer, "This is a test ende");  // Added this line.

    printf("Start \r");

    while( TRUE ){

        //gets(buffer);
        if( strstr(buffer, buff1) )
            break;
       
        printf("---> %s\r", buffer);

    }   
    printf("Ende Test\r");

while(1);
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group