473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

pack and unpack

Hi,

Can anyone give some explanation on these two php functions. Or post some links that have clear explanation on these functions. I am kind of not clear on these after reading about these in the php website.

Thank you.
Apr 15 '08 #1
3 2131
TheServant
1,168 Expert 1GB
What don't you understand? Why are you using them if you don't know what they do? I am not sure what more you can explain than they change data to and from binary to any specified format. Never used them and I am not entirely sure where I would, so maybe if you tell what you're trying to do?
Apr 16 '08 #2
I am using a database(berkeley db) where the data is stored in binary format. I want to use pack function to convert some values into binary so that i can compare them directly with the data in the database. I am doing so because, converting all the data in the db and comparing it with the values i said is taking a lot of time. The data base is very huge and time is important for me over here.

The value of one record is a long sequence of binary data and i take only the required no of bits. like say a sequence of 8 bits.

Can you help me now?
Apr 18 '08 #3
TheServant
1,168 Expert 1GB
So do you get an error when using the unpack() function? I have never used it, and I was hoping someone who had would see this thread. What happens when you do: unpack($your_binary_code) ?
Apr 20 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Johannes | last post by:
Hi, I tried to pack eight integer values and one string into one binary string, which I would like to store in a mysql db. I encountered two problems doing this: 1) $this->packed =...
2
by: Sergey Dorofeev | last post by:
I can use string.unpack if string in struct uses fixed amount of bytes. But is there some extension to struct modue, which allows to unpack zero-terminated string, size of which is unknown? E.g....
4
by: Stacy Mader | last post by:
Greetings all, I have a VMS binary file with weather data. The record on each line is 1xint(8) 12xint(2) Using the perl unpack function, I can decode the binary file like this: <snip>
18
by: p.lavarre | last post by:
Can Python not express the idea of a three-byte int? For instance, in the working example below, can we somehow collapse the three calls of struct.pack into one? 08 12 34 56 80 00 I ask...
0
by: Steve | last post by:
Are there any gurus of the pack/unpack world out there that can help me with this one? I have an encrypted string which I'm reading from a zipped file. It was written using pack ( "la" ....
5
by: andmarti | last post by:
If I build a strict with: import struct print struck.pack ('i', 1) it returns a '\n'. What's wrong with it??? :( --
1
by: praveen0437 | last post by:
hi i know about format argument in pack and unpack like b h i etc but in some cases i am getting < or = symbols along with them what does they signifies for example struct.pack( "<cI", 'n',...
5
by: tmp123 | last post by:
Hello, Thanks for your time. After review the "struct" documentation, it seems there are no option to pack/unpack zero terminated strings. By example, if the packed data contains: byte +...
0
by: kardon33 | last post by:
Ok what i am trying to do with my script i send a poll and receive a reply and read that reply. I have the Poll work properly but what i need help with is trying to convert the reply from ascii to...
1
by: joe shoemaker | last post by:
If you have the following: data = unpack('>L', sock.recv(4)) Does this line of code means that incoming data is big endian and unpack it to endianess of local machine? If local machine is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.