小编net*_*der的帖子

从PHP扩展获取运行脚本的名称

我正在为PHP编写一个小扩展.有没有办法在运行时知道正在运行的脚本文件(例如:)的名称test.php?也许一些全球或环境变量?

php c php-extension php-internals

1
推荐指数
1
解决办法
480
查看次数

PHP getimagesize变量

我正在尝试使用该getimagesize函数来获取高度和图像.我从数据库中提取图像URL.(该字段ProjectURL包含一行等xxx.jpg).但是我收到了一个错误.

码:

$testing = "projects/'.$row['ProjectURL'].'";
    list($width, $height, $type, $attr) = getimagesize($testing);
    echo "Image width " .$width;
echo "<br />";
echo "Image height " .$height;
Run Code Online (Sandbox Code Playgroud)

错误:

解析错误:语法错误,意外T_ENCAPSED_AND_WHITESPACE,期待T_STRING或T_VARIABLE或T_NUM_STRING

php getimagesize

0
推荐指数
1
解决办法
3124
查看次数

宏等效(C/C++)?

鉴于这个宏:

#define SOME_MACRO(ret, f, args) \
    typedef ret (*some_func_##f) args; \
    static some_func_##f my_func_##f = NULL;
Run Code Online (Sandbox Code Playgroud)

请让我知道相应的:

SOME_MACRO(void,  myFunctionName, (int a));
Run Code Online (Sandbox Code Playgroud)

谢谢.

c macros c-preprocessor

0
推荐指数
1
解决办法
243
查看次数

正常阻塞后检测到HEAP CORRUPTION(#55)

调试后我收到此错误消息:正常块后检测到HEAP CORRUPTION(#55).如果我增加阵列的大小(no_of_days+1),它正在工作,但我不知道它是否正确.我做错了什么?

int main()
{

    int no_of_days=0;
    int no_operations=0;
    int *a;
    int i;
    FILE *pfile1=NULL;
    FILE *pfile2=NULL;
    char *filename1="input.txt";
    char *filename2="output.txt";

    pfile1=fopen(filename1, "r");
    if(pfile1==NULL)
    {
        printf("Error on opening the file %s.",filename1);
        return 0;
    }
    fscanf(pfile1,"%d%d",&no_of_days,&no_operations);
    a=(int*)malloc((no_of_days)*sizeof(int));
    if(a==NULL)
    {
        printf("Memory allocation failed.");
        return 0;
    }
    for(i=1;i<=no_of_days;i++)
    {
        fscanf(pfile1,"%d",&a[i]);
    }
    pfile2=fopen(filename2,"a");
    if(pfile2==NULL)
    {
        printf("Memory allocation failed!",filename2);
    }
    for(i=1;i<=no_of_days;i++)
    {
        fprintf(pfile2,"%d",a[i]);
    }
    free(a);
    fclose(pfile1);
    fclose(pfile2);
Run Code Online (Sandbox Code Playgroud)

c

0
推荐指数
1
解决办法
1648
查看次数

在C++中使用算法头文件时出错

我创建了一个unix域服务器客户端.它完美无缺地运行.

然后我想使用头文件中的random_shuffle()函数algorithm.所以我只包含algorithm头文件.我没有做任何其他改动.但是现在在编译时我收到以下错误:

game.cpp:102:85: error: no match for ‘operator!=’ in ‘std::bind(_Functor&&, _ArgTypes&& ...) [with _Functor = int&, _ArgTypes = {sockaddr*, long unsigned int}, typename std::_Bind_helper<_Functor, _ArgTypes>::type = std::_Bind<int(sockaddr*, long unsigned int)>]((* &((sockaddr*)(& address))), (* &110ul)) != 0’
game.cpp:102:85: note: candidates are:
/usr/include/c++/4.6/bits/stl_pair.h:214:5: note: template<class _T1, class _T2> constexpr bool std::operator!=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)
/usr/include/c++/4.6/bits/stl_iterator.h:297:5: note: template<class _Iterator> bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
/usr/include/c++/4.6/bits/stl_iterator.h:347:5: note: template<class _IteratorL, class _IteratorR> bool std::operator!=(const std::reverse_iterator<_IteratorL>&, const std::reverse_iterator<_IteratorR>&) …
Run Code Online (Sandbox Code Playgroud)

c++ bind include

0
推荐指数
1
解决办法
2559
查看次数

将32位int存储到char缓冲区中

我正在使用UDP程序收集要发送到char数组的数据,但我需要发送的数据是32位int.我该如何发送这些数据?

c int udp char

0
推荐指数
1
解决办法
2950
查看次数

标签 统计

c ×4

php ×2

bind ×1

c++ ×1

c-preprocessor ×1

char ×1

getimagesize ×1

include ×1

int ×1

macros ×1

php-extension ×1

php-internals ×1

udp ×1