strcmp比较下注预定义和接收字符串

时间:2018-01-23 06:56:05

标签: c arrays string debugging

这是一个mplab和声代码,我试图在客户端接收数据,我想从服务器插座控制LED,文本“START”将LED打开,“STOP”将LED关闭,当我调试代码,它显示Appbuffer [80]具有所有空变量,ACK [] =最后一个变量为null \ 0,在AOK []中相同。我想知道这是比较字符串的正确方法在这里写了代码。因为当我调试代码时,它会转义此行并跳转到服务器任务init()。请帮帮我。

 WebDriver driver;
        System.setProperty("webdriver.ie.driver",
                "C:\\Users\\MR049860\\Documents\\Selenium\\IEDriverServer\\IEDriverServer.exe");
        driver = new InternetExplorerDriver();
        driver.get("https://www.example.com");

        // Input Email id and Password If you are already Register
        driver.findElement(By.name("j_username")).sendKeys("publisher");
        driver.findElement(By.name("j_password")).sendKeys("Passw0rd");
        WebDriverWait wait = new WebDriverWait(driver, 5);
        WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.id("BtnButton__")));
        // WebElement ele = driver.findElement(By.id("ctllogonBtnButton__"));
        element.sendKeys(Keys.ENTER);
        // create file named Cookies to store Login Information     
        File file = new File("madhu.data");                         
        try     
        {     
            // Delete old file if exists
            file.delete();      
            file.createNewFile();           
            FileWriter fileWrite = new FileWriter(file);                            
            BufferedWriter Bwrite = new BufferedWriter(fileWrite);                          
            // loop for getting the cookie information      

            // loop for getting the cookie information      
            for(Cookie ck : driver.manage().getCookies())                           
            {           
                Bwrite.write((ck.getName()+";"+ck.getValue()+";"+ck.getDomain()+";"+ck.getPath()+";"+ck.getExpiry()+";"+ck.isSecure()));                                                                                                    
                Bwrite.newLine();             
            }           
            Bwrite.close();         
            fileWrite.close();  

        }
        catch(Exception ex)                 
        {       
            ex.printStackTrace();           
        }

1 个答案:

答案 0 :(得分:1)

由于调用了函数memset,AppBuffer全为null。 我没有在你发布的代码中看到,AppBuffer被分配了一个值。 因此,AppBuffer本质上是一个零长度字符串,因此当您将其与AOK进行比较时,结果为false。