我有两个课程如下
class A
{
};
class B
{
int a[];
};
int main()
{
cout << sizeof(A) <<endl; //outputs 1
cout << sizeof(B) <<endl; //outputs 0
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我很熟悉,空类的大小是1,但为什么B类的大小会变成零呢?
我在用c ++创建的dll中有这个
extern "C" __declspec(dllexport)
char* __stdcall hh()
{
char a[2];
a[0]='a';
a[1]='b';
return(a);
}
Run Code Online (Sandbox Code Playgroud)
这就是我试图处理c#中的代码的方式
[DllImport(@"mydll.dll",CharSet = CharSet.Ansi,CallingConvention = CallingConvention.StdCall)]
public static extern IntPtr hh();
static void Main(string[] args)
{
IntPtr a = hh();
//How to proceed here???
}
}
Run Code Online (Sandbox Code Playgroud)
帮助进一步继续.
当我使用这段代码时,我可以用文字制作图像,但是在一行中,
function writetext($image_path,$imgdestpath,$x,$y,$angle,$text,$font,$fontsize) {
$image=imagecreatefromjpeg("$image_path");
$height = imageSY($image);
$width = imageSX($image);
$color = imagecolorallocate($image,0,0,0);
$textwidth = $width;
imageTTFtext($image,$fontsize,$angle,$x,$y,$color,$font, $text );
ImageJPEG($image,$imgdestpath);
}
Run Code Online (Sandbox Code Playgroud)
请告诉我如何在多行段落中制作此图像?