-
Open For Binary
I am saving data as binary to my file, but VB6 is automatically adding some extra lines that are not in my write string. I think it is the identifier for the file type as binary if i wanted to get the file contents.. but i cannot have that line there... How do I remove it?
-
"some extra lines" or "one extra line" ?
I think it's ONE only extra line, coz probably u r using "Print" for writting, use "Put" instead ..
**When VB read a file, it doesn't read AT ALL extra lines and information needed by the OS for the file structure, it reads the contained data only; "Print" automatically put a "CR+LF" at the end of the data.
-
well, first, you could put a semi-colon at the end of the print to suppress that, and, second, it is multiple lines "08000c00" <-- as viewed in a reverse byte order hex editor in between every 2 lines of my string.
I am using put, btw.
-
The Put statement only writes the number of bytes, based on the size of the variable, to the file.
So you either have extra data in your output string, or you have another stray piece of code that is writing to your file.
-
any ideas on why this code would generate data other than what i have in the text box plus string mstrcd and 0000000 & modeset?
Last edited by cryo.burned; 09-19-2008 at 08:43 AM.
Reason: Fixed Code Tags
-
Yes, because Variants are not strings.
Variants do include extra bytes to help describe what type of data is in them.
Don't use binstr5, a Variant type, for output; use a string variable.
Or better yet , change the Variants to strings and eliminate the problem completely.
You are also using the wrong slash in your file name. It should be "\CodeList.BIN". I am surprised this did not cause an error.
Also your code blocks should be just: code, Not code=vb
-
for the code,some forums do it differently... one forum had a code=vb and it syntaxed the code and everything. but maybe i didnt get an error because my version of VBis weird. one minute some code will work and the next without changing it the same code doesnt work. its vb6 but i dont have al the vb6 commands :S
-
 Originally Posted by cryo.burned
its vb6 but i dont have al the vb6 commands :S
If you are using VB6, then you have VB6....I don't understand what you mean by this. What "commands" do you feel you are missing?
-
like the command Left$ / Left
so i can have another question about open for binary..
issues using get. i can seem to open anything it is like this correct:
Code:
Dim fnum As Integer
Dim filestr as String
fnum = FreeFile
Open CommonDialog1.FileName For Binary As #fnum
Get #fnum,(starting opening position),(place to store the contents of file)
Close #fnum
right?
i get an error like invalid procedure or call or the files uses an automation method visual basic does not support. How can this happen?
-
-
I can use get and it opens no problem. The moment i touch the string though, it dies.
Last edited by cryo.burned; 09-19-2008 at 08:43 AM.
-
What do you mean "it dies"?
-
if i try to move the string into a text box, or convert it to ASCII, or anything really, my program kills itself, with error description invalid procedure or call.
-
 Originally Posted by cryo.burned
if i try to move the string into a text box, or convert it to ASCII, or anything really, my program kills itself, with error description invalid procedure or call.
What is the exact error message and error number?
-
Error #5, Invalid Procedure or Call.
Debug points to this line:
Code:
binset3 = binset3 & Asc(Mid(binset2, x, 1))
Similar Threads
-
By anthony1709 in forum .NET
Replies: 2
Last Post: 04-03-2007, 09:27 AM
-
By Dan Dubinsky in forum java.announcements
Replies: 0
Last Post: 06-27-2002, 09:02 PM
-
By Anonymous in forum Open Source
Replies: 0
Last Post: 06-08-2002, 07:51 PM
-
By Anonymous in forum Open Source
Replies: 0
Last Post: 05-12-2002, 09:05 PM
-
By Anonymous in forum Open Source
Replies: 0
Last Post: 01-29-2002, 10:41 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|