string name; name = "C:\\Display.txt"; // Open the file. FileStream fs = new FileStream(name, FileMode.Open); //printFont = new Font("Lucida Console", 9); // Create a BinaryReader on the file. BinaryReader br = new BinaryReader(fs); // Dim an array of bytes big enough to hold the file's contents. Byte[] bytes = new Byte[fs.Length]; int bSuccess=0; // Your unmanaged pointer. IntPtr pUnmanagedBytes = new IntPtr(0); int nLength; nLength = Convert.ToInt32(fs.Length); // Read the contents of the file into the array. bytes = br.ReadBytes(nLength); // Allocate some unmanaged memory for those bytes. pUnmanagedBytes = Marshal.AllocCoTaskMem(nLength); // Copy the managed byte array into the unmanaged array. Marshal.Copy(bytes, 0, pUnmanagedBytes, nLength); PrtSetFont(10002); PrtPosAbsV(2); PrtPosAbsH(5); PrtPosRelV(2); PrtPosRelH(1); fs.Close(); int lines1 = File.ReadAllLines(name).Count(); int Number1 = lines1 / 26; if (lines1 > 26) { File.WriteAllText("C:\\Display-1.txt", String.Empty); bSuccess = PrtWrite(pUnmanagedBytes, nLength); }
nLength = Convert.ToInt32(fs.Length);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)