473,654 Members | 3,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to retrieve non fixed-length records from a binary file in C#

1 New Member
Hello,

I'm new to programming and C#, so please bear with my ignorance!

I need to extract jpeg images and header data from a binary file.

The binary file is formatted with several fixed length fields containing information about the jpeg image, followed by the jpeg itself, followed by more header data, another jpeg, etc...

Using a FileStream and BinaryReader I am able to read and store the metadata, because I know the length of the fields, but I am stumped on how to read and store the jpeg bytes since they vary in size.

There is a fixed record delimiter between each header data/jpeg record, so I was thinking of using that to break apart the records. Once they are seperated and the header fields read, I could just assume the rest is the jpeg and store that. I'm not sure how to go about doing that though.

Any suggestions or demo code is greatly appreciated!

Thanks!
Feb 28 '07 #1
1 1600
kenobewan
4,871 Recognized Expert Specialist
Here is an article that may help:
Storing Binary Files Directly in the Database Using ASP.NET 2.0
Mar 1 '07 #2

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

Similar topics

6
17705
by: James Turner | last post by:
I am trying to store formatted text (windows format) into a MySQL database and then retrieve it. The field in the database is a varchar. I cut and paste the test into a form field formatted, then call the PHP program to add the record using POST. When I get the text out, it has lost it's formatting. Formatting in the text is achieved by multiple spaces not tabs, but even multiple spaces are converted to a single space and the carrage...
79
14056
by: Klaus Bonadt | last post by:
In order to protect software from being copied without licence, I would like to use something like a key, which fits only to the current system. The serial number of the CPU or the current operating system would be appropriate. However, I do not know how to retrieve the information. Could you help? Klaus
5
11218
by: chin | last post by:
Hi, I am trying to retrieved the value of the textarea with the newline preserved without having to submit the form to the server. Does anyone knows how to? I tried soft and hard wrap but both does not seems to affect the input in anyway. Example : <form name=frm> <textarea name=ta wrap="soft"></textarea> </form>
11
2017
by: Sandfordc | last post by:
I have tried several time to do this but have been unsucessful. I tried something like: myFunction(charater) str=frm.s1.value sb1=str.substring(0,charater) sb2=str.substring(charater,str.length)
4
1660
by: Maya | last post by:
Hello Everybody, I have an application that receives a text in this format: Received from john by server.com with ESMTP (SMTPD32-8.05) id AD5258A0142; Sun, 01 Aug 2004 02:54:26 +0100 From: "John smith" To: "maya" Subject: Test message Date: Sun, 1 Aug 2004 03:00:43 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced...
1
1665
by: murl | last post by:
Is it just me or is there no easy way to open an excel file, and get the column names that are usually in the 1st row? I would like to be able to do this for a import tool im writing in vb.net and c#. I need to be able to list what columns are available in the excel file, so the user can map these to a ms sql table. Dim oExcelApp As New Excel.Application() Dim oWorksheet As Excel.Worksheet Dim i As Integer = 0
13
2193
by: no.mail.pls | last post by:
Hiya, How do i retreive fields with similar values from 2 tables? I tried to use (1) "SELECT * FROM $table1 as o , $table2 as p WHERE o.name like '%p.name%'"; but it retrieves nothing at all. (2) "SELECT * FROM $table1 as o , $table2 as p WHERE o.name like p.name";
0
886
by: Hilda | last post by:
I have an application that works Great!! on my machine using VB.NET 2005. When I publish the application to the server I found out that I keep getting "Invalid credentials" when I try to login. I fixed the problem adding the line applicationName="/website1" to my web.config membership section. Now the problem is that I do not get "Invalid credentials" but now I keep getting the login in window, no error message or nothing just the...
6
3458
by: Dylan Nicholson | last post by:
Running as an administrator, I can retrieve the account password stored by IIS for any application pool (using the WAMUserPass property). But, unsurprisingly, an ASP.NET application running inside an application pool that is does not have administrator privileges can't even enumerate the list of application pools. I can access the application pool by hard-coding the name, but even then the WAMUserPass is an empty property value...
2
1670
by: John | last post by:
I am having trouble getting this code to work, and was wondering if someone could tell me what I am doing wrong. -------------------------------------- CODE-------------------------------------- if (isset($_POST)) { require_once("database.php"); $appt_date = $_POST . '/' . $_POST . '/' . $_POST;
0
8290
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8707
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8482
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.