Results 1 to 23 of 23

Thread: Get the returned values from PHP

  1. #1

    Thread Starter
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255

    Exclamation Get the returned values from PHP

    Hi all!
    I don't know if you get my last thread so I repost it again.
    Please give an answer - even tho you're not sure about it.

    I need your help! Please!


    I want to execute a PHP-Script thru my "Webserver" but just executing the interpreter wouldn't bring anything I suppose.

    So what do I have to do, to tell the interpreter to execute a script and also get its output?? How to set values in PHP like $HTTP_SERVER_VARS etc.


    The webserver is a small http/1.1 compatible webserver programed in VB6 with Winsock.

    I am using PHP 4.0.6 in c:/php/php.exe .


    Thanks in advance,
    dmr.
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    What does this look like??!! A PHP forum??!

    Try this one instead http://www.vbforums.com/forumdisplay.php?forumid=11

  3. #3
    Frenzied Member
    Join Date
    Aug 2001
    Posts
    1,075
    http://www.ipdg3.com/ is not a real active spot but they do have a good selection of forums dedicated to PHP.

    Greg
    Free VB Add-In - The Reference Librarian
    Click Here for screen shot and download link.

  4. #4

    Thread Starter
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    Originally posted by chrisjk
    What does this look like??!! A PHP forum??!

    Try this one instead http://www.vbforums.com/forumdisplay.php?forumid=11
    Infact it is NOT a PHP-Question.

    I bet that those who are in the PHP-Forum don't even know what VB is...


    It is a question to get the returned value from an executed program - in this case php.exe - through another program - a VB-program.

    So. Any ideas??

    Tia.
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  5. #5
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Sorry, but to be honest I only read the subject, so too did Greg by the looks of it

  6. #6
    Frenzied Member
    Join Date
    Aug 2001
    Posts
    1,075
    Well, when I execute APS pages through VB I connect via port 80 to the server and then GET the ASP page (and pass it paramers) just as I would an HTML page. Since I'm connected to port 80 I just wait for a response from the web server.

    How are you calling the PHP page (show code)

    Greg
    Free VB Add-In - The Reference Librarian
    Click Here for screen shot and download link.

  7. #7
    Frenzied Member
    Join Date
    Aug 2001
    Posts
    1,075
    PS: Is PHP.EXE configured correctly? Even if you are not running WinNT this may help.

    NOTE: I'll assume the following in the instructions:
    * Windows NT is installed in C:\WINNT
    * Your IIS webroot is at C:\INETPUB\WWWROOT
    * You have decompressed the PHP files to C:\PHP
    * You will use the extension .PHP for your PHP files [Others use extensions like .PHTML, .CGI, .PHP4, etc.]

    Adjust accordingly.
    ____________________________________________________________
    1. Download the PHP .zip file from www.php.net or www.zend.com.
    ____________________________________________________________
    2. Decompress the contents of the .zip file to the directory C:\PHP.
    ____________________________________________________________
    3. Move the MSCVRT.DLL and PHP4TS.DLL files in C:\PHP to C:\WINNT\SYSTEM32.
    ____________________________________________________________
    4. Copy C:\PHP\PHP.INI-DIST to C:\PHP\PHP.INI, then move C:\PHP\PHP.INI to C:\WINNT\PHP.INI.
    ____________________________________________________________
    5. Modify C:\WINNT\PHP.INI so that the information contained in it reflects your environment. This will require reading through the PHP.INI file and learning what the various parameters mean, but for starters find and modify the following:

    doc_root = "C:\INETPUB\WWWROOT"
    extension_dir = "C:\PHP"

    Later, as you become more familiar with PHP, be sure to go back to C:\WINNT\PHP.INI and look at sections such as

    ...
    [mail function]
    ...
    [Sessions]
    ...

    and modify them accordingly so that you can start using some of the cooler features in PHP.
    ____________________________________________________________
    6. Run the MMC.
    ____________________________________________________________
    7. Right-click on the webserver you wish to have PHP support added to.
    ____________________________________________________________
    8. Select Properties from the popup menu.
    ____________________________________________________________
    9. In the dialog box that appears (which has 2 rows of tabs), click on the "ISAPI Filters" tab and make sure you do NOT have a filter in place that uses the php4isapi.dll file. If there are any, delete them.
    ____________________________________________________________
    10. Click on the "Home Directory" tab, then click on the [Configuration...] button.
    ____________________________________________________________
    11. Click on the "App Mappings" tab and see whether you have a mapping for the extension ".php".
    ____________________________________________________________
    12. If the mapping already exists, click on that mapping to select it and click the [Edit] button. If the mapping does NOT yet exist, click the [Add...] button.
    ____________________________________________________________
    13. In the dialog box that comes up, be sure that it reads

    +-------------------------------------------------
    | Add/Edit Application Extension Mapping
    +-------------------------------------------------
    | Executable: C:\PHP\php.exe %s %s
    | Extension: .php
    | Method Exclusions:
    | [x] Script engine
    | [x] Check that file exists [OK] [Cancel] [Help]
    +-------------------------------------------------
    ____________________________________________________________
    14. Click [OK] 3 times to save the changes you have just made. You can now exit the MMC.
    ____________________________________________________________
    15. Though not absolutely necessary, if possible, reboot NT or shutdown/restart the w3svc (using "net stop iisadmin" and "net start w3svc" from a Command Prompt).

    At this point, your box should be configured for PHP. To test, create a file called C:\INETPUB\WWWROOT\TEST.PHP which reads

    <?
    phpinfo();
    ?>

    and then view it in your browser by entering

    http://site/test.php

    where "site" is either the IP address of the NT box, it's DNS name, or the word "localhost" if you are using a browser on the same box.

    This should generate a page full of information on the installed version of PHP.
    Greg
    Free VB Add-In - The Reference Librarian
    Click Here for screen shot and download link.

  8. #8

    Thread Starter
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    Thank you Greg, but I don't think that will help me.

    I'm not quite sure if you get exactly what I mean so I try to explain it more clearly:

    My OS is Win2k.
    I'm using PHP 4.0.6 (correctly configured and so on) with Apache 1.3.20 (also working fine). So that is not the problem.

    I have build my own webserver for implementation in another program and it needs to support PHP (CGI as well).

    So how do I execute the PHP-Script and how will it get those variables like $HTTP_GET_VARS ? PHP can't read'em out it self so I have to tell him what has been send via POST or GET and so on.

    And when it has done its work how do I get the result? I don't think PHP creates some files with the output or something like that...

    Will the normal Shell work? I don't think so.


    Thanks in advance,
    dmr.
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  9. #9
    Frenzied Member
    Join Date
    Aug 2001
    Posts
    1,075
    Sorry, I am clueless as to what you want.

    Gre
    Free VB Add-In - The Reference Librarian
    Click Here for screen shot and download link.

  10. #10
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    You want to put CGI functionality into your web server?

    Well, I think your server would have to run the .exe file with its standard input, standard output, and environmental variables "remapped" (not sure of the best term, and I'm not exactly sure how to implement that). Then the cgi app just writes to standard output, which goes to the web server instead of the screen, and that pretty gets sent as the http response (the web server might do some processing, like add extra http headers, etc). The web server places the cgi environmental variables into the standard environmental variable table for the cgi app, so the cgi app can read them thru it's languages method (like the GetEnvironmentVariable API call for C or VB). Finally, I believe incoming form POST data is encoded and placed into standard input, which the cgi app can read from.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  11. #11

    Thread Starter
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255

    Thumbs up

    Thanks, Josh.
    That is what I want to do.

    But indeed the question is not what but how?
    So how will I do that? How can I execute PHP/CGI, transmit the environment, and get the response?

    Any ideas?
    Tia.
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  12. #12
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Based on a quick skim of MSDN, I believe under Windows you can use the CreateProcess API call, and then something like SetStdHandle to redirect std in/out.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  13. #13
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    please don't yell at me for posting again dmr but i have a small suggestion...

    In the php.ini file which comes with PHP, there was this:
    ; You can redirect all of the output of your scripts to a function. For
    ; example, if you set output_handler to "ob_gzhandler", output will be
    ; transparently compressed for browsers that support gzip or deflate encoding.
    ; Setting an output handler automatically turns on output buffering.
    output_handler =
    i don't know if it would help, but i thought that might be of some use as you might be able to send the output to a function then to your web server...

    If you are really desperate you could check how Apache does it - as it is open source (i think it's written in C++ though ), then try to implement that method into your application....

    cya

  14. #14

    Thread Starter
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    Originally posted by JoshT
    Based on a quick skim of MSDN, I believe under Windows you can use the CreateProcess API call, and then something like SetStdHandle to redirect std in/out.
    Thanks Josh,
    CreateProcess was a good tip but in MSDN I didn't find anything that looks quite useful...

    Btw: There is no API called SetStdHandle but one which is called GetStdHandle but I wasn't able to discover its use. There are several Console-API's might they help me? And when how?
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  15. #15

    Thread Starter
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    Originally posted by da_silvy
    please don't yell at me for posting again dmr but i have a small suggestion...

    In the php.ini file which comes with PHP, there was this:


    i don't know if it would help, but i thought that might be of some use as you might be able to send the output to a function then to your web server...

    If you are really desperate you could check how Apache does it - as it is open source (i think it's written in C++ though ), then try to implement that method into your application....

    cya
    Thanks Dave for your reply.
    I think today I won't close the thread

    Ok. I tried to get an overview from Apache Src but I'm fed up with this code by now. After a couple of hours I think I found the functions which are responsible for executing CGI/PHP but I didn't get where the are exactly transmitting the content. I changed some values and recompiled it but nothing changed ...

    Later I realized that it was the CGI-Debug-Mode but I'm not sure if that isn't the same.

    From /apache/src/modules/standard/mod_cgi.c
    static int cgi_child(void *child_stuff, child_info *pinfo)
    {
    struct cgi_child_stuff *cld = (struct cgi_child_stuff *) child_stuff;
    request_rec *r = cld->r;
    char *argv0 = cld->argv0;
    int child_pid;

    #ifdef DEBUG_CGI
    #ifdef OS2
    /* Under OS/2 need to use device con. */
    FILE *dbg = fopen("con", "w");
    #else
    FILE *dbg = fopen("/dev/tty", "w");
    #endif
    int i;
    #endif

    char **env;

    RAISE_SIGSTOP(CGI_CHILD);
    #ifdef DEBUG_CGI
    fprintf(dbg, "Attempting to exec %s as %sCGI child (argv0 = %s)\n",
    r->filename, cld->nph ? "NPH " : "", argv0);
    #endif

    ap_add_cgi_vars(r);
    env = ap_create_environment(r->pool, r->subprocess_env);

    #ifdef DEBUG_CGI
    fprintf(dbg, "Environment: \n");
    for (i = 0; env[i]; ++i)
    fprintf(dbg, "'%s'\n", env[i]);
    #endif

    #ifndef WIN32
    ap_chdir_file(r->filename);
    #endif
    if (!cld->debug)
    ap_error_log2stderr(r->server);

    /* Transumute outselves into the script.
    * NB only ISINDEX scripts get decoded arguments.
    */

    #ifdef TPF
    return (0);
    #else
    ap_cleanup_for_exec();

    child_pid = ap_call_exec(r, pinfo, argv0, env, 0);
    #if defined(WIN32) || defined(OS2)
    return (child_pid);
    #else

    /* Uh oh. Still here. Where's the kaboom? There was supposed to be an
    * EARTH-shattering kaboom!
    *
    * Oh, well. Muddle through as best we can...
    *
    * Note that only stderr is available at this point, so don't pass in
    * a server to aplog_error.
    */

    ap_log_error(APLOG_MARK, APLOG_ERR, NULL, "exec of %s failed", r->filename);
    exit(0);
    /* NOT REACHED */
    return (0);
    #endif
    #endif /* TPF */
    }

    Any C++ programmers in?
    Please help!

    Thanks again to both of you.
    dmr.
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  16. #16
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Here's SetStdHandle:
    http://msdn.microsoft.com/library/de...nchar_7y79.asp

    This link at the bottom looks like it might be useful to you:
    http://msdn.microsoft.com/library/de...thred_4uus.asp
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  17. #17

    Thread Starter
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    Josh, I saw you writing in the C and C++ Forum so it seems to me that you know what you're talking about...
    I'd be very pleased if you can translate the second code into VB. I tried it, but I failed. I can rewrite simple C++ codes but that one...

    Or is there somebody in the C and C++ Forum you know who has nothing to do at the moment and who I can ask for? Or should I just post there?


    Thank a lot for your help!
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  18. #18
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Um, actually I'm still learning (always learning...), so converting that code to VB is still a little beyond me... ( I could probably get it if I stuggled with it for awhile).

    Go ahead and ask on the C forum. There's some smart people there.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  19. #19

    Thread Starter
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    That doesn't matter. I opened a thread in the C-Forum.

    I have to express my gratitude to you.
    Thanks a lot for your patience!

    dmr.
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  20. #20
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Ok. I do have a simple app in VB that does the opposite of what you want -- runs as CGI under IIS. Some of the API declarations and such should be same. I'll post it tomorrow if you want it.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  21. #21

    Thread Starter
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    Sounds really interesting.
    Please post it!

    Tia.
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

  22. #22
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    This would go into a module, and set project startup to Sub Main. Enjoy!

    VB Code:
    1. Option Explicit
    2.  
    3. Private Const STD_ERROR_HANDLE As Long = -12&
    4. Private Const STD_INPUT_HANDLE As Long = -10&
    5. Private Const STD_OUTPUT_HANDLE As Long = -11&
    6.  
    7. Private Const GENERIC_WRITE As Long = &H40000000
    8. Private Const FILE_SHARE_READ As Long = &H1&
    9. Private Const OPEN_ALWAYS As Long = 4&
    10. Private Const FILE_ATTRIBUTE_ARCHIVE As Long = &H20&
    11.  
    12. Private Const FILE_END As Long = 2&
    13.  
    14. Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long
    15.  
    16. Private Declare Function WriteFile Lib "kernel32.dll" (ByVal hFile As Long, _
    17.     lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, _
    18.     lpNumberOfBytesWritten As Long, lpOverlapped As Any) As Long
    19.    
    20. Private Declare Function CreateFile Lib "kernel32.dll" Alias "CreateFileA" _
    21.     (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, _
    22.     ByVal dwShareMode As Long, lpSecurityAttributes As Any, _
    23.     ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, _
    24.     ByVal hTemplateFile As Long) As Long
    25.    
    26. Public Declare Function SetFilePointer Lib "kernel32.dll" (ByVal hFile As Long, _
    27.     ByVal lDistanceToMove As Long, lpDistanceToMoveHigh As Long, _
    28.     ByVal dwMoveMethod As Long) As Long
    29.  
    30. Private Declare Function GetStdHandle Lib "kernel32" _
    31.     (ByVal nStdHandle As Long) As Long
    32.    
    33. Private Declare Function GetEnvironmentVariable Lib "kernel32" Alias "GetEnvironmentVariableA" _
    34.     (ByVal lpName As String, ByVal lpBuffer As String, ByVal nSize As Long) As Long
    35.  
    36. Private Declare Function AllocConsole Lib "kernel32" () As Long
    37. Private Declare Function FreeConsole Lib "kernel32" () As Long
    38.  
    39. Public Sub Main()
    40.     Dim STDOUT As Long 'handle to standard output
    41.     Dim strHTTP As String 'data buffer for HTTP header output
    42.     Dim strBuffer As String 'data buffer for writing to the log file
    43.     Dim lngBytesWritten As Long 'the number of bytes that were written
    44.     Dim retval As Long 'API return value
    45.     Dim FILEOUT As Long 'handle to the file to log to
    46.     'CGI Variables
    47.     Dim strQueryString As String
    48.     Dim strRemoteAddr As String
    49.     Dim strHTTPUserAgent As String
    50.    
    51.     'fill the buffers with nothing
    52.     strQueryString = Space$(256)
    53.     strRemoteAddr = strQueryString
    54.     strHTTPUserAgent = strQueryString
    55.    
    56.     'get and store the CGI variables needed
    57.     retval = GetEnvironmentVariable("QUERY_STRING", strQueryString, 256)
    58.     strQueryString = Left$(strQueryString, retval)
    59.     retval = GetEnvironmentVariable("REMOTE_ADDR", strRemoteAddr, 256)
    60.     strRemoteAddr = Left$(strRemoteAddr, retval)
    61.     retval = GetEnvironmentVariable("HTTP_USER_AGENT", strHTTPUserAgent, 256)
    62.     strHTTPUserAgent = Left$(strHTTPUserAgent, retval)
    63.    
    64.     strHTTP = "Location: ./win2000.gif" & vbCrLf & vbCrLf
    65.    
    66.     'start the console
    67.     'retval = AllocConsole 'UNCOMMENT FOR IDE DEBUGGING
    68.    
    69.     'get the handle to standard output
    70.     STDOUT = GetStdHandle(STD_OUTPUT_HANDLE)
    71.    
    72.     'write the string to STDOUT, just like writing to a file
    73.     retval = WriteFile(STDOUT, ByVal strHTTP, Len(strHTTP), lngBytesWritten, ByVal 0&)
    74.  
    75.     'close the handle to standard out
    76.     retval = CloseHandle(STDOUT)
    77.    
    78.     'close the console
    79.     'retval = FreeConsole 'UNCOMMENT FOR IDE DEBUGGING
    80.    
    81.     'open the file for writing
    82.     FILEOUT = CreateFile("C:\Inetpub\wwwroot\Test\image.log", GENERIC_WRITE, FILE_SHARE_READ, _
    83.         ByVal 0&, OPEN_ALWAYS, FILE_ATTRIBUTE_ARCHIVE, 0)
    84.    
    85.     'if error
    86.     If FILEOUT = -1 Then Exit Sub
    87.        
    88.     'fill the buffer
    89.     strBuffer = Now & ";" & strQueryString & ";" & strRemoteAddr & ";" & strHTTPUserAgent & vbCrLf
    90.        
    91.     'move the file pointer to EOF
    92.     retval = SetFilePointer(FILEOUT, 0, 0, FILE_END)
    93.    
    94.     'write the buffer to the file
    95.     retval = WriteFile(FILEOUT, ByVal strBuffer, Len(strBuffer), lngBytesWritten, ByVal 0&)
    96.        
    97.     'close the handle to the file
    98.     retval = CloseHandle(FILEOUT)
    99. End Sub
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  23. #23

    Thread Starter
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255
    Thanks Josh!
    The code works great!

    I haven't tried yet to rewrite it for my needs but I think I do it on weekend.

    Thanks for your patience!
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width