pragma solidity ^0.4.10;

contract Byte{

    bytes [] public T=new bytes[](3);

    function setLeng(uint len) public{
T.length=len;
T.push('0x11');
} //bytes [5] public T1=new bytes[](5);
//Type bytes memory[] memory is not implicitly convertible to
//expected type bytes storage ref[5] storage ref //bytes [5] public T1 = [1,2,3,4,5];
//Type uint8[5] memory is not implicitly convertible to expected
//type bytes storage ref[5] storage ref uint [5] public T1=[1,2,3,4,5]; //bytes [2] public T2 = [0x11,0x12];
//uint [] storage T2= new uint[](5);Expected identifier, got 'Storage' uint [] public T2= new uint[](5);
function setLeng1(uint len) public{
//T1.length=len;//Expression has to be an lvalue
//uint [5] memory T0=[1,2,3,4,5];Type uint8[5] memory is not implicitly convertible to expected type uint256[5] memory
uint [5] memory T1=[uint(1),2,3,4,5];
for (uint i;i<T1.length;i++){
T2[i] = T1[i];
}
} function getByte() view public returns(bytes){
//return T;
//return bytes(T2);
} bytes3 public b=0x123344;
byte[3] public b1;
bytes public b2 = new bytes(3);
string public s1="liny"; function f0() public{
for(uint i;i<b.length;i++){
b2.push(b[i]);
}
}
function f1() returns(string){
return string(b2);//"string: \u0000\u0000\u0000\u00123D"
}
function f2() returns(bytes){
return bytes(s1);//bytes: 0x6c696e79
}
}

ethereum(以太坊)(基础)--容易忽略的坑(三)的更多相关文章

  1. ethereum(以太坊)(基础)--容易忽略的坑(二)

    pragma solidity ^0.4.0; contract EMath{ string public _a="lin"; function f() public{ modif ...

  2. ethereum(以太坊)(基础)--容易忽略的坑(一)

    pragma solidity ^0.4.0; contract base{ address public _owner=msg.sender; uint _a; string internal _b ...

  3. C#以太坊基础入门

    在这一部分,我们将使用C#开发一个最简单的.Net控制台应用,来接入以太坊节点,并打印 所连接节点旳版本信息.通过这一部分的学习,你将掌握以下技能: 如何使用节点仿真器 如何在命令行访问以太坊节点 如 ...

  4. ethereum(以太坊)(一)

    从这周开始,开始学习以太坊开发--solidity,开始决定往区块链方向发展,毕竟区块链技术应用广泛.一开始接触solidity开发语言不太习惯,毕竟一直在学习python语法,有很多都不能接受.有难 ...

  5. ethereum(以太坊)(十二)--应用(二)__投票(基础总和)

    编写应用合约之前,先弄清它的逻辑,有助于我们更好的部署合约 pragma solidity ^0.4.21; pragma experimental ABIEncoderV2; contract vo ...

  6. ethereum(以太坊)(实例)--"安全的远程购买"

    pragma solidity ^0.4.10; contract Safebuy{ uint public price; address public seller; address public ...

  7. ethereum(以太坊)(实例)--"简单的公开竞拍"

    说真的,刚开始接触这个竞拍案例--“简单的公开竞拍”,我就抱着简单的心态去查看这个实例,但是自我感觉并不简单.应该是我实力不到家的原因吧!!!233333...不过经过大半天的努力,自己理解完之后,觉 ...

  8. ethereum(以太坊)(十四)--Delete

    pragma solidity ^0.4.10; contract Delete{ /* delete可用于任何变量(除mapping),将其设置成默认值 bytes/string:删除所有元素,其长 ...

  9. ethereum(以太坊)(十三)--异常处理/元祖

    pragma solidity ^0.4.4; contract Students{ uint[] data= new uint[](4); address _owner = msg.sender; ...

随机推荐

  1. react里面stateless函数的默认参数

    function fn({  children,  params,  dispatch,  location}) { }

  2. JQuery Tips

    另一篇文章 JavaScript Tips 1. 获取span标签的值需要用text(); 2. datepicker控件的‘setDate’属性可用于设置默认值: 3. 使用parseFloat转换 ...

  3. Unity Android 真机调试

    官方文档 https://docs.unity3d.com/Manual/AttachingMonoDevelopDebuggerToAnAndroidDevice.html 然而 按照官方文档 很多 ...

  4. Angular js 双向绑定时字符串的转换成 数字类型的问题

    问题: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <scrip ...

  5. 快速开始Python/WSGI应用程序

    快速开始Python-wsig应用程序 官方参考文档 安装 uwsgi 安装 pip install uwsgi uwsgi --version # 查看 uwsgi 版本 测试 uwsgi 是否正常 ...

  6. DevExpress控件水印文字提示 z

    ButtonEdit.Properties.NullValuePrompt = "提示"; ButtonEdit.Properties.NullValuePromptShowFor ...

  7. 【java开发系列】—— Tomcat编译报错

    由于之前Eclipse里面有一个可移植性的web工程,但是在我很久没用后,再次登录这个IDE的时候就发现了问题. 首先,我的电脑里面有两个版本的JDK,1.6和1.7.两个版本的Tomcat6和7以及 ...

  8. netstat 和 lsof 查看网络状态

    netstat和lsof都是linux下的工具,可以用于查看系统的网络状态. netstat netstat可以打印 网络连接,路由表,接口统计数据,还有多播和masquerade连接相关的东西(不熟 ...

  9. 一对多sql

    <!-- 分页查询派货成本 --> <select id="queryCostRegionPriceBycondtion" parameterMap=" ...

  10. Xpath定位_1:子找父以及contains的用法

    先上xml代码,如下图,在写自动化脚本时,需要定位到数字为10334的td元素.td元素的父元素.父的父元素以及属性值都一样:只有同胞元素的元素值不同.以此可以通过先定位到同胞元素,在找到父元素下的期 ...