小编Rud*_*uis的帖子

在Char数组中发送†字符而不是空格字符

我已经将项目从XE5迁移到了西雅图10。我仍在使用ANSII代码与设备通信。在我的新构建中,Seattle IDE在Char数组中发送†字符而不是空格char(在Ansii代码中为#32)。我需要将空格字符数据发送到文本文件,但不能。

我尝试了#32(就像我以前使用过的一样),#032和#127,但是它不起作用。任何的想法?

这是我的用法:

fillChar(X,50,#32);
Run Code Online (Sandbox Code Playgroud)

方法签名(var X; count:Integer; Value:Ordinal)

arrays delphi pascal char delphi-10-seattle

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

Java逻辑测试问题花式编号

1.花哨的数字是序列1,1,5,17,61中的数字,...... 

请注意,前两个花哨的数字是1,除了前两个之外的任何花哨的数字都是前一个的两倍和前一个的两倍之和.见下文: 

1,1,

3*1 + 2*1 = 5

3*5 + 2*1 = 17

3*17 + 2*5 = 61

编写一个名为isFancy的函数,如果其整数参数是一个Fancy数,则返回1,否则返回0.该函数的签名是int isFancy(int n)

解决方案:

public class fancynumber {
public static void main(String[] args) {
    System.out.println(isFancy(5));
     System.out.println(isFancy(17));
      System.out.println(isFancy(61));
}

private static int isFancy(int i) {
    int previous = 1;
    int pprevious = 1;
    int set = 0;
    int currentvalue = 0;
    for(int a = 0; a<i;a++){

       currentvalue = 3*previous + 2*pprevious;

        if(currentvalue==i){
            set = 1;
            break;
        }
        else{
            set = 0;
        previous = …
Run Code Online (Sandbox Code Playgroud)

java arrays

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

装配中局部变量的大小

我有以下C功能:

void function(int a) {
  char buffer[1];
}
Run Code Online (Sandbox Code Playgroud)

它产生以下汇编代码(gcc,0优化,64位机器):

function:
  pushq %rbp
  movq  %rsp, %rbp
  movl  %edi, -20(%rbp)
  nop
  popq  %rbp
  ret
Run Code Online (Sandbox Code Playgroud)

问题:

  • 为什么缓冲区占用20个字节?
  • 如果我声明char buffer而不是char buffer[1]偏移是4个字节,但我希望看到8,因为机器是64位,我认为它将使用qword(64位).

在此先感谢,如果问题重复,我很抱歉,我无法找到答案.

c assembly gcc x86-64 word-size

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

访问冲突在Delphi 10.2 Tokyo中移植32到64位

试图将一些代码从32位delphi移植到64.编译后我得到一个访问违规在64位补丁的这一行(在32上正常工作)

 PByte = ^Byte;

function TyDecoder.findCRLF(pStart,pEnd: PByte): PByte;
begin
 while (Not (((pStart^=13) and (pByte(Integer(pStart)+1)^=10)) or (pStart^=10))) and (Integer(pStart)<Integer(pEnd))   do Inc(pStart);
 Result:=pStart;
end;
Run Code Online (Sandbox Code Playgroud)

以前有许多问题从D7移植到10.2东京但是通过将所有字符串声明更改为Ansistring来纠正这些问题.

我猜这可能与指针类型有关,现在是8而不是4.

难住了.

delphi 64-bit

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

访问违规Delphi程序

请帮我处理以下代码.单击"登录"按钮后,我从delphi获得了Access违规....表示为!!!

登录单位

unit Log;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls,cls_LogIn,Jpeg;

type
  TForm2 = class(TForm)
    lbllogIn: TLabel;
    pnlSplitter: TPanel;
    edtUserName: TEdit;
    edtPassword: TEdit;
    lblUserName: TLabel;
    lblPassword: TLabel;
    btnLogIn: TButton;
    btnRegister: TButton;
    lblRegister: TLabel;
    edtRegName: TEdit;
    edtRegSurname: TEdit;
    edtRegPassword: TEdit;
    edtCountry: TEdit;
    edtHomelanguage: TEdit;
    btnRegisterF: TButton;
    btnCancel: TButton;
    lblRegName: TLabel;
    lblRegSurname: TLabel;
    lblRegPassword: TLabel;
    lblCountry: TLabel;
    lblHomelanguage: TLabel;
    imgLinks: TImage;
    imgRegs: TImage;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure btnLogInClick(Sender: TObject);
  private

  public

    { Public …
Run Code Online (Sandbox Code Playgroud)

delphi oop access-violation

-2
推荐指数
1
解决办法
801
查看次数

Java Double无法解除引用

我需要乘以radius*radius*pi找到圆的确切区域,但我写下的代码不起作用.它是不断给予双重不能被解除引用的错误...

错误

 ----jGRASP exec: javac -g Circle.java
Circle.java:7: error: double cannot be dereferenced
      BigDecimal area = radius.multiply(pi);
                              ^
1 error
Run Code Online (Sandbox Code Playgroud)

import java.math.*;
public class Circle {
   public BigDecimal findArea(double radius){
      double pi = 3.14159;
      radius = radius * radius;
      BigDecimal bd = new BigDecimal("1");
      BigDecimal area = pi.multiply(radius);
      return area;
   }
}
Run Code Online (Sandbox Code Playgroud)

java bigdecimal

-3
推荐指数
1
解决办法
235
查看次数