buffer

C - Why is my buffer not printing properly?

江枫思渺然 提交于 2019-12-13 11:13:46
问题 I have two objects, Header, and DF. lets say header = CCCCCC7E and DF = 01020304 , shouldnt the value of the buffer be CCCCCC7E01020304 ? for some reason when i printed it i got: 7EFFFFFFCCFFFFFFCCFFFFFFCCFFFFFFCCFFFFFFCCFFFFFFCCFFFFFFCCFFFFFFCCFFFFFFCC00FFFF FFCC00000000000004030201FFFFFF8967341200000000 this is how i printed it: for (int i = 0; i < sizeof(buffer); i++) { printf("%02X", buffer[i]); } this is the code: struct Header header; struct Data_Format DF; unsigned char buffer[TOTAL

C++: Populate a struct with data from a buffer

◇◆丶佛笑我妖孽 提交于 2019-12-13 09:46:31
问题 I was wondering if I could have some recommendations on how to take data from a buffer and load them into a struct. For example, I have dealing with a DNS response buffer. I need to populate a DNS answer struct so that I can interpret the data. So far, I have the following: int DugHelp::getPacket() { memset(buf, 0, 2000); // clearing the buffer to make sure no "garbage" is there if (( n = read(sock, buf, 2000)) < 0 { exit(-1); } // trying to populate the DNS_Answers struct dnsAnswer = (struct

Java windows write bytes to file, some are incorrect [duplicate]

≯℡__Kan透↙ 提交于 2019-12-13 08:27:35
问题 This question already has an answer here : File Channel reads/adds wrong data (1 answer) Closed 3 years ago . My goal is to read a stream of bytes from the socket into a file, and then play it back at a later time as test harness for my application. Somewhere in writing bytes to disk, a byte will get written incorrectly, seemingly at random. My writer looks like this: blobWriter = new BufferedOutputStream(new FileOutputStream(blobFileName)); blobChannel = Channels.newChannel(blobWriter); I'm

Can't get TClientSocket to receive buffer values

杀马特。学长 韩版系。学妹 提交于 2019-12-13 08:23:16
问题 On the server side, text is entered into a memobox. This text is then sent to the Server side using this code: var ftmpstr :String; buf :array[0..255] of char; msize, nyites :dword; i :Integer; .. Command := Socket.ReceiveText; if split(Command,'|', 0) = 'IBATCH' then begin ftmpstr := IBat.Memo1.Text; nyites := 1; msize := length(ftmpstr); Server.Socket.Connections[ListView1.Selected.Index].SendText(IntToStr(msize)); while msize>255 do begin for i := 0 to 255 do buf[i] := ftmpstr[nyites+i];

Unpack in a SSB

狂风中的少年 提交于 2019-12-13 07:57:19
问题 I use part of a SSB as a matrix 3D of linked lists. Each voxel of the matric is a uint that gives the location of the first element of the list. Before each rendering, I need to re-init this matrix, but not the whole SSB. So I associated the part corresponding to the matrix with a texture 1D to be able to unpack a buffer inside it. //Storage Shader buffer glGenBuffers(1, &m_buffer); glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, m_buffer); glBufferData(GL_SHADER_STORAGE_BUFFER,

C# Streaming video over NetworkStream / TCPClient

不问归期 提交于 2019-12-13 07:13:07
问题 I am sending a video feed from an Xbox Kinect from a client program to a server. I have everything working but the problem is the frame rate. I'm thinking what is happening is it is sending faster than it can read. So when it can't send anymore it stores what it is about to send and waits until there is room in the buffer. The reason I think this is what is happening is because I can see the memory usage of the program steadily growing. Also because when I watch the video feed, I see

get buffered data exoplayer

£可爱£侵袭症+ 提交于 2019-12-13 07:05:00
问题 I am not very experienced building Android apps and I am trying to make a small app using ExoPlayer. So hopefully you guys can pardon my ignorance. I am essentially trying to see if there is a way to get access to the buffered files. I searched around, but there doesn't seem to be an answer for this. I saw people talking about cacheDataSource, but then I thought, isn't the data already being cache by virtue of it buffering? For instance, when a video starts, it start buffering. I t continues

AudioRecord obtainBuffer Timed out with AudioRecorder.startRecording()

[亡魂溺海] 提交于 2019-12-13 06:22:46
问题 I have a problem with my program which records the microphone. Sometimes when I run it I have the following warnings and no sound is actually recorded: 12-14 11:17:50.660: W/AudioRecord(1857): obtainBuffer timed out (is the CPU pegged?) user=00000000, server=00000000 From what I have found, other have this problem with AudioTrack as explained here and here. However, for me it is AudioRecord which is not working properly. I understand that the buffer cannot be created for whatever reason. The

How to extract Y,U, and V components from a given yuv file using Matlab? Each component is used for further pixels level manipulation

跟風遠走 提交于 2019-12-13 05:45:47
问题 Hey guys. I'm currently playing with YUV file. Do you have any suggestion on how to extract y,u,v components from a yuv video? I found a piece of program which was shown below. But I don't know which part is the valid components that I want. Thanks. % function mov = loadFileYuv(fileName, width, height, idxFrame) function [mov,imgRgb] = loadFileYuv(fileName, width, height, idxFrame) % load RGB movie [0, 255] from YUV 4:2:0 file fileId = fopen(fileName, 'r'); subSampleMat = [1, 1; 1, 1];

UInt8 EXC_BAD_ACCESS

纵饮孤独 提交于 2019-12-13 04:50:16
问题 I have a method that will add a filter to an image. This worked fine until a couple of months ago, now when I try to use this method the application will crash on the images buffer. I create the buffer and set it to the image's data, accessing the specific index later causes a bad access crash. I have looked for the past hour or two, and now I am convinced there is something im overlooking. I think something is being released that should not be. I am using the ios DP 4 preview of xcode, and I