Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: changing encryption password size Pin
jtmtv1818-Feb-03 12:10
jtmtv1818-Feb-03 12:10 
GeneralSecurity question Pin
Omega50117-Feb-03 13:30
Omega50117-Feb-03 13:30 
GeneralRe: Security question Pin
jtmtv1817-Feb-03 13:46
jtmtv1817-Feb-03 13:46 
GeneralRe: Security question Pin
Omega50117-Feb-03 14:07
Omega50117-Feb-03 14:07 
GeneralRe: Security question Pin
jtmtv1817-Feb-03 14:16
jtmtv1817-Feb-03 14:16 
GeneralRe: Security question Pin
Omega50117-Feb-03 15:21
Omega50117-Feb-03 15:21 
GeneralRe: Security question Pin
Furty17-Feb-03 16:55
Furty17-Feb-03 16:55 
GeneralReading Files From Offset Pin
afronaut17-Feb-03 13:19
afronaut17-Feb-03 13:19 
Hello all -

I'm trying to write some code to read ID3 tags from mp3 files. ID3 stores information at *the end* of the mp3 file in 128 bytes.

I want to avoid having to loop through the entire file to get the data that I need but it appears that one only can read from the beginning of a file using the .NET I/O classes.

Is it possible to call a version of a Read method with an offset specifying where in a file you want to start reading into a byte array?

eg:
string path = "c:\\downers\\Mancini.mp3";
FileInfo fi = new FileInfo(path);
// the file length
long len = fi.Length;
// subtract 128
long start= len - 128;
int st = (int)start;
Stream fis = File.Open(path,FileMode.Open, FileAccess.Read);
BinaryReader re = new BinaryReader(fis);
byte[] data = new byte[128];
re.Read(data, start, 128); // this won't work, but you get my intuitions...

This doesn't work though; the offset argument in the middle of the read method is an offset in the byte array to start on.

Any ideas? Am I missing something obvious? Otherwise I just have code that loops through the entire file a byte at a time. Cry | :((

*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
GeneralRe: Reading Files From Offset Pin
Xpander17-Feb-03 16:14
Xpander17-Feb-03 16:14 
GeneralRe: Reading Files From Offset Pin
Wesner Moise17-Feb-03 16:21
Wesner Moise17-Feb-03 16:21 
GeneralRe: Reading Files From Offset Pin
afronaut18-Feb-03 2:43
afronaut18-Feb-03 2:43 
GeneralRe: Reading Files From Offset Pin
Furty17-Feb-03 17:05
Furty17-Feb-03 17:05 
Questionprinting in .net problem? Pin
zhoujun17-Feb-03 13:13
zhoujun17-Feb-03 13:13 
GeneralMethod lock Pin
Filip Strugar17-Feb-03 12:55
Filip Strugar17-Feb-03 12:55 
GeneralRe: Method lock Pin
Wesner Moise17-Feb-03 16:03
Wesner Moise17-Feb-03 16:03 
QuestionHow do you use this DLL in C#? Pin
draco_iii17-Feb-03 9:43
draco_iii17-Feb-03 9:43 
AnswerRe: How do you use this DLL in C#? Pin
Anders Molin17-Feb-03 14:12
professionalAnders Molin17-Feb-03 14:12 
GeneraldotEASY Pin
Anonymous17-Feb-03 9:38
Anonymous17-Feb-03 9:38 
QuestionQ: How to Click a Button in Another Application Programatically in C#? Pin
Alwazeer17-Feb-03 7:28
Alwazeer17-Feb-03 7:28 
AnswerRe: Q: How to Click a Button in Another Application Programatically in C#? Pin
TigerNinja_17-Feb-03 7:55
TigerNinja_17-Feb-03 7:55 
QuestionC# Syntax Highlighting? Pin
se99ts17-Feb-03 6:00
se99ts17-Feb-03 6:00 
AnswerRe: C# Syntax Highlighting? Pin
Furty17-Feb-03 9:47
Furty17-Feb-03 9:47 
GeneralRe: C# Syntax Highlighting? Pin
se99ts17-Feb-03 9:51
se99ts17-Feb-03 9:51 
QuestionIs it possible to declare reference variable? Pin
Thomas W17-Feb-03 4:27
Thomas W17-Feb-03 4:27 
AnswerRe: Is it possible to declare reference variable? Pin
TigerNinja_17-Feb-03 7:33
TigerNinja_17-Feb-03 7:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.