reading files

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: reading files

Tony Morehen
Audio or development


On 2017-07-20 02:40 PM, Hans Lehmann wrote:

> Am 20.07.2017 um 20:27 schrieb Tony Morehen:
>> I've uploaded the class with a short command line demo to the
>> software farm.
>
> Hello Tony,
>
> under which heading can I find the class in the software farm?
>
> Honsek
> ------------------------------------------------------------------------------
>
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: reading files

Shane-2
Hi tony I think i found a small bug in your code when reading mp3 files
with no version 2 tag

this function gets a end of stream error

Public Function ReadBytes(Count As Integer) As Byte[]

   Dim res As New Byte[Count]
   res.Read($Stream)
   Return res
End

In the StreamReader Class

don't know if you want to do any thing about it ?

regards Shane


On 21/07/17 04:50, Tony Morehen wrote:

> Audio or development
>
>
> On 2017-07-20 02:40 PM, Hans Lehmann wrote:
>> Am 20.07.2017 um 20:27 schrieb Tony Morehen:
>>> I've uploaded the class with a short command line demo to the
>>> software farm.
>>
>> Hello Tony,
>>
>> under which heading can I find the class in the software farm?
>>
>> Honsek
>> ------------------------------------------------------------------------------
>>
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Gambas-user mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> ------------------------------------------------------------------------------
>
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: reading files

Jussi Lahtinen
In reply to this post by Shane-2
"Title[30] As String" does not declare 30 characters, but 30 strings.


Jussi


On Tue, Jul 18, 2017 at 3:50 AM, Shane <[hidden email]> wrote:

> i don't know what i am doing wrong
>
> Public Struct ID3v1_TAG              '(128 bytes)
>      Tag[3] As String               'always TAG
>      Title[30] As String             'title, 30 characters
>      Artist[30] As String           'artist, 30 characters
>      Album[30] As String           'album, 30 characters
>      Year[4] As String              'year, 4 characters
>      Comment[30] As String          'comment, 30 characters (or 28 if
> track# included)
>      Genre As Byte                   'genre, 255 for none defined
> End Struct
>
>
> Private Sub GetID3v1(File As String)
>     Dim IDtag As ID3v1_TAG
>     Dim hfile As File
>
>     hfile = Open File For Read
>
>         '
>         'read the tag
>         ' seek to end of less tag size
>
>         Read #hfile, IDtag, ID3v1_TAG
>
> here i get IDtag is NULL
>
>
>
> On 18/07/17 05:05, [hidden email] wrote:
>
>> Yes it is possible, I do it.  here is some code (incomplete)
>>
>> -Nando (Canada)
>>
>>
>>
>> ' top of class file
>> Public Struct recstruc
>>    _a as integer
>>    _b as integer
>>    _c as integer
>> end struct
>>
>>
>> ' a function
>> public function openAfile(filename as string) as file
>>
>> dim hfile as file
>> dim arec as recstruc
>>
>> hfile = open filename for read write create
>>
>> with arec   'some values to write.
>>    ._a = 1
>>    ._b = 22
>>    ._c = 333
>> end with
>>
>> write #hfile, arec as recstruc
>>
>> 'if you position the hfile pointer back to zero, you can...
>> read #hfile, arec as recstruc
>>
>> close #hfile
>>
>> end
>>
>>
>>
>>
>>
>>
>> --
>> Open WebMail Project (http://openwebmail.org)
>>
>>
>> ---------- Original Message -----------
>> From: T Lee Davidson <[hidden email]>
>> To: [hidden email]
>> Sent: Sun, 16 Jul 2017 12:42:35 -0400
>> Subject: Re: [Gambas-user] reading files
>>
>> On 07/16/2017 06:57 AM, Shane wrote:
>>>
>>>> given this example
>>>>
>>>> PRIVATE SUB BinaryRead(FilePath AS String)
>>>>     DIM binaryFile AS File
>>>>     DIM i AS Integer
>>>>     DIM b AS Byte
>>>>     DIM s AS Short
>>>>     DIM s1 AS String
>>>>     DIM s2 AS String
>>>>     ' Read binary file
>>>>     binaryFile = OPEN FilePath FOR READ
>>>>     READ #binaryFile, i
>>>>     READ #binaryFile, b
>>>>     READ #binaryFile, s
>>>>     READ #binaryFile, s1
>>>>     READ #binaryFile, s2
>>>>     CLOSE #binaryFile
>>>>     ' Display results
>>>>     PRINT i
>>>>     PRINT b
>>>>     PRINT s
>>>>     PRINT s1
>>>>     PRINT s2
>>>> END
>>>>
>>>>
>>>> is there a way for gambas to read a struct of all these variables
>>>> in one read ?
>>>>
>>>> You may have hinted at the solution within your question. Have you
>>> considered
>>> using a Structure?
>>>
>>> http://gambaswiki.org/wiki/lang/read :
>>> "... reads the stream Stream as binary data whose type is specified by
>>> the
>>> Datatype argument."
>>>
>>> "The returned datatype can be one of the following: NULL, Boolean, Byte,
>>> Short,
>>>   Integer, Long, Pointer, Single, Float, Date, String, Variant, any
>>> Array,
>>>   Collection or structure."
>>>
>>> http://gambaswiki.org/wiki/lang/structdecl
>>>
>>> --
>>> Lee
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Gambas-user mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>
>> ------- End of Original Message -------
>>
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Gambas-user mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
12
Loading...