This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C206 warning & C267 error while using atoi function

Hello everybody,

First of all I thank you all. With the help of you people I have started programming in C. I have completed my first project in C.

Now in my another project, I used the atoi function. I am getting warning & an error like-

MAIN.C(255): warning C206: 'atoi': missing function-prototype
MAIN.C(255): error C267: 'atoi': requires ANSI-style prototype

If I use the function without any argument, I get no errors. I have included the function prototypes, some of my code is as..

void data_rcvd_proc()
{
        char *recd_cmd;                         // command part of the string
        unsigned char *recd_dat;                // data part of the string
        unsigned char idata tmp_data[17];

        ES=0;                                                   // disable serial interrupt

/*      SET DATA        */
        if (strpos (RxBuffer, '=') != -1){                      // if '=' found
                recd_cmd = strtok(RxBuffer,"=");
                recd_dat = strtok(NULL,"+");

                if(strcmp(recd_cmd, "DELAY_TIME")==0){
//                      delay_time = atoi(recd_dat);            //atoi converts ascii number string into integer
                }

                else if(strcmp(recd_cmd, "UP")==0){
//                      up_time = atoi(recd_dat);               //atoi converts ascii number string into integer
                }

                else if(strcmp(recd_cmd, "Down")==0){
                        up_time = atoi();                       //atoi converts ascii number string into integer
                }

        }
}


Pleas help! I cannot understand the problem because in my previous project I HAD EXACTLY USED THE SAME WAY & IT WAS WORKING PERFECTLY , Thanks.

Parents
  • Thanks Per, everything is clear to me know. I had not included the stdlib.h file anywhere in my previous project, but I had declared the atoi function in my file.

    
    void init_all();                                        //initialise all things
    unsigned char segs2ascii(unsigned char);
    void read_rtc();
    void write_rtc();
    char kbhit();
    void gps_rcvd_proc();
    void data_rcvd_proc();
    int atoi(char *string);   /* string to convert */
    void read_eeprom();
    void write_eeprom();
    void erase_eeprom();
    void SER_init();
    void beep(ms);
    
    

    Thanks again

Reply
  • Thanks Per, everything is clear to me know. I had not included the stdlib.h file anywhere in my previous project, but I had declared the atoi function in my file.

    
    void init_all();                                        //initialise all things
    unsigned char segs2ascii(unsigned char);
    void read_rtc();
    void write_rtc();
    char kbhit();
    void gps_rcvd_proc();
    void data_rcvd_proc();
    int atoi(char *string);   /* string to convert */
    void read_eeprom();
    void write_eeprom();
    void erase_eeprom();
    void SER_init();
    void beep(ms);
    
    

    Thanks again

Children