المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : C# .net pointer to variable length array



C# Programming
03-10-2012, 09:02 AM
I'm trying to figure out how to pass pointers to variable length arrays. I can't seem to get this to work. Any help? It looks like this:

class CHandler:public int ReadFileBytes(string fileName, byte[] dataForReturn) //can probably leave second param as-is?{ //read it here but return both ptr to array and //int return status code FileStream fs = File.OpenRead(fileName); dataForReturn = new byte[fs.length]; fs.Read(dataForReturn, 0, dataForReturn.Length); fs.Close(); int status = 1; return status;} class DUser:private void button_Click(...){ //??not sure if this is how I call my accessor method Read_File(fileName, byte[]dataForReturn); //??the above dataForReturn will eventually be //passed to someone} //??not sure if this is how second param needs to bepublic int Read_File(string fileName, Byte[]* data){ CHandler fio = new CHandler(); //??not sure about how access method to get data int result = fio.ReadFileBytes(fileName, data);}