Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
strlen在Dev计算机上返回不同的值_Strlen - Fatal编程技术网

strlen在Dev计算机上返回不同的值

strlen在Dev计算机上返回不同的值,strlen,Strlen,嘿,伙计们,我正在从混合字符串中提取一些单词。首先,我使用fgets函数从文本文件中获取行,当然,这是它附带的。下面是要处理的示例字符串 {,(,),}\n\0 要从字符串中丢弃\n和“,”,我正在使用此代码段 int k=0; int inputWordIndex=0; while(k<strlen(tempInputLine)) { if(tempInputLine[k]!=','&&a

嘿,伙计们,我正在从混合字符串中提取一些单词。首先,我使用fgets函数从文本文件中获取行,当然,这是它附带的。下面是要处理的示例字符串

{,(,),}\n\0
要从字符串中丢弃\n和“,”,我正在使用此代码段

       int k=0;

        int inputWordIndex=0;

        while(k<strlen(tempInputLine))
        {
            if(tempInputLine[k]!=','&&tempInputLine[k]!='\n')
            {
                inputWord[inputWordIndex]=tempInputLine[k];
                inputWordIndex++;
            }
            k++;
        }
        inputWord[inputWordIndex]='\0';
intk=0;
int inputWordIndex=0;

虽然(kYou没有提供太多的信息。根据您提供的信息,我将做一个粗略的猜测,并说另一台机器上的文本文件实际上以
\r\n
结尾,这会导致大量的计算。如果您想要一个真实的答案,请提供两台机器的真实数据,以及操作系统和其他信息。我认为您的疯狂g使用ir右。当我设置该行包含7个有意义的字符时,斯特伦给了我10个值。我认为额外值应该是\r\n\0。