Question

I read this commands in c++ language

FILE * fp;
BYTE r,g,b;
fp=fopen(fn,"rb");
fread((BYTE * )&b,sizeof(BYTE),1,fp);

I am Bigeneer in c# ,what is similar commands in c# langugehow can I use pointer (BYTE * )&b in c#

Was it helpful?

Solution

You can use FileStream object for File operations and for opening the file you can use File.Open instead of fOpen

OTHER TIPS

You can use this for all lines :

using system.IO;

string[] mylines = System.IO.File.ReadAllLines(@"myfile.txt");

Or this for one line :

  string mytext = System.IO.File.ReadAllText(@"myfile.txt");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top