473,587 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem writing a byte to binary file

2 New Member
Expand|Select|Wrap|Line Numbers
  1. 'Reading file Byte-by-Byte
  2. Dim Rs As Byte = bReader.ReadByte()
  3.  
  4. 'Converting Byte To Integer
  5. Dim n As Integer = CType(Rs, Integer)
  6.  
  7. 'Function Input Integer    (0-255)
  8. Function a(byval n as integer) as integer
  9. 'Function Output Integer   (0-255)
  10.  
  11. 'Convert Integer to Byte                
  12. Rs = CType(n, Byte)
  13.  
  14. 'Write Byte to Stream
  15. bWriter.Write(Rs)
  16. 'Result: Example: .pdf show no visible character
  17. 'Thanks, in advance, for the help.
  18.  
Jan 19 '11 #1
0 1016

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

Similar topics

7
3773
by: Keith Dewell | last post by:
Greetings! My current job has brought me back to working in C++ which I haven't used since school days. The solution to my problem may be trivial but I have struggled with it for the last two days and would appreciate this group's helpful expertise. My problem may be related to mixing the C and C++ languages together. Namely, I have a...
1
2041
by: Atri Mandal | last post by:
Hi, Can anyone provide me some useful C++ code for creating/writing a .wav file. I looked at some sites on the net and did something myself but every time there is a "Damaged File or unsupported format error". I need to create a wav file (PCM 16-bit mono with 44.1 K sampling rate). Please let me know whether there are any sites which provide...
1
2959
by: Jaime Montes | last post by:
I have found that adding in the start of the file the character '-1' and '-2' I can read the file as a Unicode, and to write any character I have to write pairs of character so for 'a' I write '0' + 'a'. My problem is that when I write '\n' or char(10) the ofstream write char(13) + char(10) when I only need it write char(10), so I want to...
3
5483
by: Romain | last post by:
Hello, I am writing out a binary file. I figured that the number "10" is automaticaly converted to "OD OA" instead of "OD". "OD" and "OA" are line feed and carriage return. I know it does that if the file is opened in something else than in binary mode. But in my example below, the file is really opened in binary.
4
16919
by: Gidi | last post by:
Hi, i have a byte array, and i'm writing it to a file, i want to start a new line, how can i do it? (like WriteLine in StreamWriter) I'm using FileStream: FileStream fs = new FileStream(file_name,FileMode.Create ); Aftrer i used fs.Write(Byte b1); i want to start a new line in my file and then write my second array Byte
4
2203
by: Greg | last post by:
Using the HttpWebRequest I'm downloading a PDF file and am trying to save it to the hard drive, but it keeps ending up corrupt (according to adobe acrobat). I know the PDF file isn't corrupt because I can view it if I save it from IE. I've tried saving it using the BinaryWriter, TextWriter, and StreamWriter. All have produced the corrupt...
2
1149
by: Eduardo Biano | last post by:
I am a python newbie and I have a problem with writing each record read to a file. The expected output is 10 rows of records, but the actual output of the code below is only one row with a very long record (10 records are lump into one record). Thank you in advance for your help. Here is the code: **************************************** ...
1
2263
by: Quinn | last post by:
Hi all, I have some binary files in the following format: text line 1 text line 2 .... text line N end of text single in binary 1 single in binary 2 single N EOF
4
1867
by: Bonzol | last post by:
Hello!, I'm just trying to write my string to a simple binary file so it can't be read in a text document,, however it doesn't work.. I do this FileStream fs = File.Create(Server.MapPath("secret.txt")); BinaryWriter bw = new BinaryWriter(fs); bw.Write("You should not be able to read me"); bw.Close();
3
1650
by: bpejman | last post by:
I have a Perl-driven website on a windows 2003 server. I have configured the IIS and have set the permissions on the Home Directory tab to Read, Write and my Execute Permissions are set to "Scripts and Executable." I have gotten the site to work but my problem is, when I run the below code from my web browser, I do not see a file called...
0
7918
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...
0
8206
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. ...
0
8340
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...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5392
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...
0
3840
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...
1
2353
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
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.