bobbynad Posted December 14, 2003 Posted December 14, 2003 vtputs (Char * f) { char cbuf[1024]; strcpy(cbuf,f); strcat(cbuf,"\n"); vtProcessedTextOut(cbuf, strlen(cbuf)); return(0); } Please , How would be the above code written in VB.Net. Quote
HJB417 Posted December 14, 2003 Posted December 14, 2003 I'll tell you what that c code is supposed to do. I don't know vb.net, maybe someone else can help, sorry. vtpus = a method that takes a cstring named 'f' and returns an int. 1) A cstring named 'cbuf' that can hold 1024 characters is made. 2) Copy the characters in 'f' to 'cbuf' 3) Invoke vtProcessedTextOut(). Parameter 1 is the string you want to use, and parameter 2 is the length of the string you want to use. 4) return 0 Just so you know, that code u posted won't compile and if f is more than 1024 bytes, you'll get a buffer overflow. for .net, you would make a method, 'vtputs', that returns an Int32 and takes a String named 'f'. line1 = vtProcessedTextOut(f, f.Length) line2 = return 0 Quote
AndreRyan Posted December 29, 2003 Posted December 29, 2003 This should do the same thing, I don't know what vtProcessedTextOut is though, I'm treating it as a second procedure. 'The command ByVal creates a COPY of the original, ByRef gets an actual reference Public Sub vtPuts(ByVal f() As Char) vtProcessedTextOut(f, f.GetUpperBound(0)) End Sub Quote .Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.