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. http状态码汇总及代表意思

    成功2×× 成功处理了请求的状态码.200 服务器已成功处理了请求并提供了请求的网页.204 服务器成功处理了请求,但没有返回任何内容. 重定向3×× 每次请求中使用重定向不要超过 5 次.301 请 ...

  2. Flexviewer使用Google地图作为底图

    Flexviewer使用Google地图作为底图: 在使用google地图作底图前提是你需要在Flex中实现加载google地图的代码(网上一大堆,随便找), 在只加载google地图的情况下,成功显 ...

  3. jquery控制滚动条

    $(function () { $("table tr td a").css('white-space', 'nowrap'); $("div[id$=ctlScroll ...

  4. Intent的简单使用

    主要实现Intent之间值得转递,如从AActivity到BActivity之间传一个数值,一个实体类,一个集合类 下面代码只要是实现对startActivityForResult的使用,用ABC 3 ...

  5. Web测试中定位bug方法

    在web测试过程中,经常会遇到页面中内容或数据显示错误,甚至不显示,第一反应就是BUG,没错,确实是BUG.进一步了解这个BUG的问题出在那里,是测试人员需要掌握的,可以简单的使用浏览器自带开发者工具 ...

  6. 微软开源 PowerShell 并支持 Linux 和 OS X

    微软近日宣布开源 PowerShell,开始支持 Linux 和 OSX.PowerShell 是面向 Windows 和 Windows Server 的自动化平台和可扩展脚本语言,可帮助用户简化系 ...

  7. python:Non-ASCII character ‘\xe2′ in file

    python 2.7系列的  在运行.py文件时 报错python:Non-ASCII character ‘\xe2′ in file 解决办法:  在文件顶部 加入  #  coding: utf ...

  8. Selenium2学习(十)-- iframe定位

    前言 有很多小伙伴在拿163作为登录案例的时候,发现不管怎么定位都无法定位到,到底是什么鬼呢,本篇详细介绍iframe相关的切换 以http://mail.163.com/登录页面10为案例,详细介绍 ...

  9. Python——追加学习笔记(二)

    文件处理 # 文件内移动 seek()方法可以在文件中移动文件指针到不同的位置,offset字节代表相对于某个位置偏移量,默认为0,代表从文件开头算起,1代表从当前位置算起,2代表从文件末尾算起. s ...

  10. 深度优先搜索(dfs),城堡问题

    题目链接:http://poj.org/problem?id=1164 1.深搜,每个点都访问一次,没有标记的话,就做深搜,同时标记. #include <iostream> #inclu ...