Function delay
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Function delay

  1. #1
    Join Date
    Nov 2006
    Posts
    290

    Function delay

    I have to download a text file from my web server then call a read function that uses ifstream. Both work separately with no problems but when I try to get them to work together it fails miserably. The read function can't do its job unless the file has been downloaded, so I put URLDownloadToFile() first in the execution. Once the file is downloaded the next thing is read opens and reads the file. What I'm trying to do is have this in a continuous loop. I tried the nested for loop method..

    Code:
    for(int i = 0; i < 100; i++){
     read()
     for(int j = 0; j < 50; j++){
      URLDownloadToFile() }
    }
    But when I add it to the bottom of my code right before the return 0, it compiles fine, but it never executes in run time. Maybe because I have 8 threads starting above the code but I don't see how that could affect it. Any suggestions? If I left something out let me know, Thanx.

  2. #2
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: Function delay

    You need to check the download status by LPBINDSTATUSCALLBACK and when finished just open and read the file.

    URLDownloadToFile just returns S_OK on successfully starting of download but not indicating the finish line.
    ◄◄ hypheni ►►

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center