Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Problem writing a jpg....

Ok... for some reason Im having a problem with this...

Im trying to write a jpg file, but for some reason its not working.

[code]
Open App.Path & "sshot.jpg" For Binary Access Write As #1
Put #1, , CurFile
Close #1
[/code]

This is all it is. I have no idea whats wrong. If i look at the string CurFile it looks as if it should write the file correctly, but when i open the file it has a few characters before it that arent in the string... What the heck?

If you know how to fix this without the source (if Im just dumb), then let me know or if you need the source let me know..

Nugget

PS By using a hex editor and removing the extra characters the picture loads fine.

Comments

  • DjSpiritDjSpirit Member Posts: 371
    : Ok... for some reason Im having a problem with this...
    :
    : Im trying to write a jpg file, but for some reason its not working.
    :
    : [code]
    : Open App.Path & "sshot.jpg" For Binary Access Write As #1
    : Put #1, , CurFile
    : Close #1
    : [/code]
    :
    : This is all it is. I have no idea whats wrong. If i look at the string CurFile it looks as if it should write the file correctly, but when i open the file it has a few characters before it that arent in the string... What the heck?
    :
    : If you know how to fix this without the source (if Im just dumb), then let me know or if you need the source let me know..
    :
    : Nugget
    :
    : PS By using a hex editor and removing the extra characters the picture loads fine.
    :

    Try opening for output and using Print #1, CurFile for writing

  • dragonstormdragonstorm Member Posts: 44
    : Ok... for some reason Im having a problem with this...
    :
    : Im trying to write a jpg file, but for some reason its not working.
    :
    : [code]
    : Open App.Path & "sshot.jpg" For Binary Access Write As #1
    : Put #1, , CurFile
    : Close #1
    : [/code]
    :
    : This is all it is. I have no idea whats wrong. If i look at the string CurFile it looks as if it should write the file correctly, but when i open the file it has a few characters before it that arent in the string... What the heck?
    :
    : If you know how to fix this without the source (if Im just dumb), then let me know or if you need the source let me know..
    :
    : Nugget
    :
    : PS By using a hex editor and removing the extra characters the picture loads fine.

    Try this, replacing "TheJPEG" with your picture.
    [code]
    private function WriteFile(WhatPath as string)
    call savepicture(TheJPEG.image, WhatPath)
    end function
    [/code]
    I don't know if this works, but it works 4 bitmap.

    [red]Dragon[/red][purple]storM[/purple]
  • TyyppiKTyyppiK Member Posts: 21
    : Ok... for some reason Im having a problem with this...
    :
    : Im trying to write a jpg file, but for some reason its not working.
    :
    : [code]
    : Open App.Path & "sshot.jpg" For Binary Access Write As #1
    : Put #1, , CurFile
    : Close #1
    : [/code]
    :
    : This is all it is. I have no idea whats wrong. If i look at the string CurFile it looks as if it should write the file correctly, but when i open the file it has a few characters before it that arent in the string... What the heck?
    :
    : If you know how to fix this without the source (if Im just dumb), then let me know or if you need the source let me know..
    :
    : Nugget
    :
    : PS By using a hex editor and removing the extra characters the picture loads fine.
    :

    It's the descriptor (or something like that). The put command puts it there. You can get rod of it by making sure the CurFile is a string (variable length) or make a temporary string.
    [code]Dim TmpStr As String
    TmpStr = CurFile
    Open App.Path & "sshot.jpg" For Binary Access Write As #1
    Put #1, , TmpStr
    Close #1[/code]
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _________ / http://forcoder.org / free ebooks and video tutorials about [ Visual Basic .NET, MATLAB, Ruby, Python, C++, Assembly, Visual Basic, PL/SQL, PHP, C#, C, Objective-C, R, Delphi, Scratch, Go, Java, JavaScript, Swift, Perl Julia, F#, FoxPro, SAS, Hack, VBScript, Lisp, ABAP, Alice, Ada, Fortran, LabVIEW, ML, Clojure, Erlang, Kotlin, Transact-SQL, Lua, Awk, Dart, COBOL, Apex, Scala, Crystal, D, Scheme, Bash, Logo, Prolog, Rust ] ________

Sign In or Register to comment.