To write string date (record) into a file that has NO CR/LF, ie. in binary mode. or stream file

I have a program that write data in line-by-line mode that use the following code
dim ch_o as integer
dim data_str as string

 ch_o = freefile()
 open "out.txt" for output as #ch_o

 data_str = "1234 56 abcd"
    print #ch_o, data_str

this way, the data is writen in to file "out.txt", and create CR/LF at the end of each line

Now, I have a need to write the datafile, that will be continous char by char,  NO CR/LF
but each data line could be a variable length.  (I suppose I can write one byte at a time).

  1. How do I open that file  (for output, or for append), must have some file type?
  2. what vb6 syntax I need to use?

     for i = 1 len(data_str)
        write ch_o, mid(data_str,i,1)

 I am sure VB6 can take care of this type of issues.  Please help me.



Who is Participating?
sakuya_suConnect With a Mentor Commented:
yeah liek that one
you can do open *** for binary output as **
mshox1Author Commented:
Sakuya,  Let me make sure I understand it correct.  are you saying I should do the following coding:

    open "my_output.dat" for binary output as #ch_o

  '  this will open the file "my_output.dat" for binary, and output mode

  to actual write the data into the file.  what I should do?
     assume we have data_str = "abcdef"
     print #ch_o, data_str
     print #ch_o, "12345"

   the data file will have "abcdef12345"   after the above 2 statement?

 Please verify, and if you can give some code example in VB6 will even better.


The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

mshox1Author Commented:
to all:

do you know if there is a 'dump' file utility program that can display the
binary code (either ascii, or hex) value for a given file.

I need to see what the output looks like (i.e. if crLF) are NOT written.


Search Google for "hex editor" :)
This is the one I use:

You can also open it in notepad if its ascii data, just dont save it
All Courses

From novice to tech pro — start learning today.