我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

inlang64中[] byte的Golang大小

//data = file in []byte 
length := len(data)

length is in type int. I need to find the length in int64. I only have the []byte data of the file. How can I find the size of data in int64?

Convert the int to an int64:

l := int64(len(data))

The length of a slice is guaranteed to fit in an int. If the file is larger than what can be represented by an int, then it's not possible to read the entire file into a []byte.

近期文章

  • 通过Node调用golang函数时无法打开文件
  • 从REST API调用更新对象-结构合并?
  • Golang:避免比赛条件
  • 在Golang中处理网址中的动态参数
  • Golang中HTTP POST的预检问题
  • 如何使用结构键解开带连字符的json字符串?
  • 使用接口的通用功能
  • 转到通道,TCP / IP端口映射未返回所有打开的端口
  • 在Golang中本地发送UDPv6
  • 有什么办法可以在正则表达式中转义Go字符串?
  • 为什么将无符号整数转换为字节数组形式以“ 3”开头的字符串?
  • 为什么种族探测器没有检测到这种种族状况?
  • 我的程序有什么错误? 我已经使用这些值了吗? [重复]
  • C# 求解 把一维阵列变成二维阵列?
  • 怎么把这个改成字符类型
  • 各位大佬这道题如何用c语言写?
  • 网站被挂木马,手机访问会跳转到垃圾站
  • 记事本程序的两个问题。
  • js多个异步函数为什么会同时执行?
  • 如何使用Go将浮点数格式化为字符串

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华