473,804 Members | 3,191 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

slurping in binary data

1 000100000000000 0001
2 000100000000000 0001
3 100000110010000 00000000001
4 100000110010000 00000000001
5 100000110010000 00000000001
6 100000110010000 00000000001
7 100000110010000 00000000001
8 100000110010000 00000000001
9 100000110010000 00000000001
10 100000110010000 00000000001
11 100000001111100
12 100000001111100
13 100000001111100
14 100000111011011 110000000000000 1
15 100000111011011 110000000000000 1
16 100000111011011 110000000000000 1
17 100000111011011 110000000000000 1
18 100000111011011 110000000000000 1
19 100000111011011 110000000000000 1
20 000100000000000 0001

1
2
*****
*****
*****
*****
*****
*****
*****
***** 10
************ 11
************
************
***** *** 14
***** ***
***** ***
***** ***
***** ***
***** ***
20

3W, 12 B, 5W
1000 0000111 1100

If I wanted to suck in the above 20 lines without line numbers, spaces,
carriage returns, line feeds, or anything that is not a zero, one or EOF,
how would I do it?

Thanks in advance,

--
George

Terrorist attacks can shake the foundations of our biggest buildings, but
they cannot touch the foundation of America. These acts shatter steel, but
they cannot dent the steel of American resolve.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/
Nov 18 '08
30 1953
George wrote:
CBFalconer wrote:
>James Kuyper wrote:
>>George wrote:
... snip ...
>>>
Would you prefer fgets to either Chuck's or Richard's enhancements?

My news server reports that there are currently 18 messages in this
thread. One was posted by Chuck Falconer, and 2 by Richard Heathfield,
none by anyone else named Chuck or Richard. All three of those
messages are short comments which don't suggest anything I would call
an enhancement. Are you referring to messages which haven't been
showing up on my news server?

I suspect George is referring to my ggets.c package. This is
available in public domain source form at:

<http://cbfalconer.home .att.net/download/ggets.zip>

#include <stdio.h>
#include <stdlib.h>
#include "ggets.h"

#define INITSIZE 112 /* power of 2 minus 16, helps malloc */
#define DELTASIZE (INITSIZE + 16)

enum {OK = 0, NOMEM};

int fggets(char* *ln, FILE *f)

! end abridged source of ggets.c
That is YOUR abridgement, not mine.
>
If this is to replace the use of gets, what need have you of
that file pointer? The only use of f is in getc(f).
Because fggets can read text lines from any file. ggets is a
macro, that supplies stdin as the source file id.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.
Nov 22 '08 #31

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6007
by: Paul | last post by:
Hi, (First apologies if this is not the most relevant place to post this but I wasn't sure of where was and I am writing my app in VB.) I'm attempting to parse a binary file for which I have the format. The format states that the general packet format is as follows Message header Hex Length of whole binary packet
13
15272
by: yaipa | last post by:
What would be the common sense way of finding a binary pattern in a ..bin file, say some 200 bytes, and replacing it with an updated pattern of the same length at the same offset? Also, the pattern can occur on any byte boundary in the file, so chunking through the code at 16 bytes a frame maybe a problem. The file itself isn't so large, maybe 32 kbytes is all and the need for speed is not so great, but the need for accuracy in the...
103
48773
by: Steven T. Hatton | last post by:
§27.4.2.1.4 Type ios_base::openmode Says this about the std::ios::binary openmode flag: *binary*: perform input and output in binary mode (as opposed to text mode) And that is basically _all_ it says about it. What the heck does the binary flag mean? -- If our hypothesis is about anything and not about some one or more particular things, then our deductions constitute mathematics. Thus mathematics may be defined as the subject in...
2
2536
by: Lisa Pearlson | last post by:
Hi, My php application (on Apache/Linux) needs to do the following: The PHP script receives a request from a client (binary), asking for certain records of data. My PHP script loops through all records and sends each of them ONE BY ONE. After each record that my server script sends, it waits for the client to confirm proper reception with an ACK (binary digit). When there are no more records, my server script sends the client a binary
28
2831
by: wwj | last post by:
void main() { char* p="Hello"; printf("%s",p); *p='w'; printf("%s",p); }
4
3696
by: knapak | last post by:
Hello I'm a self instructed amateur attempting to read a huge file from disk... so bear with me please... I just learned that reading a file in binary is faster than text. So I wrote the following code that compiles OK. It runs and shows the requested output. However, after execution, it pops one of those windows to send error reports online to the porgram creator. I have managed to find where the error is but can't see what's wrong....
6
2734
by: | last post by:
Hi all, is there a better way to stream binary data stored in a table in sql 2005 to a browser in .net 2.0? Or is the code same as in .net 1.1? We noticed that in certain heavy load scenarios, every now and then the client would timeout and have to re-initiate the request... TIA!
3
7004
by: stockblaster | last post by:
Hello all.. Is it possible to convert a DataTable (i create the DataTable from a CSV file) into binary data and save it into an sql 2005 table (into binary field). After that I want to have the ability to add a row to the beginning of the to the binary data..
1
2315
by: willakawill | last post by:
I have a very large binary file saved from a vb array with 2 dimensions; Dim arMatrix() As Byte Dim fNum As Integer ReDim arMatrix(7166, 17769) 'code here to store data from a database into this 'array 'get a free file number fNum = FreeFile()
0
9707
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
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
10586
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
10338
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
10323
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,...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5525
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...
1
4301
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
2
3823
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.