我应该如何在缓冲区之间打印值 [英] how should i print values in between buffer

查看:44
本文介绍了我应该如何在缓冲区之间打印值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有20个字节的缓冲区.

如果我这样做

file.write(缓冲区,偏移量,长度)

整行都被打印出来.

请告诉我们如何打印第4个字节到第18个字节.??

解决方案

Try:

 File.Write(buffer, 3  14 );  offset是要打印的第一个字节的从零开始的索引,因此"3"是第四个字节,而length是要打印的字节数:18-4 = 14 


i am having a buffer of 20 bytes.

if i do

file.write(buffer,offset,length)

whole line gets printed.

pls tell how to print form 4th byte to 18th byte.??

解决方案

Try:

File.Write(buffer, 3, 14);

The offset is zero based index of the first byte to print, so "3" is the fourth byte, and length is the number of bytes to print: 18 - 4 = 14


这篇关于我应该如何在缓冲区之间打印值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆