Solved

how to write in vc++

Posted on 2003-11-05
1
199 Views
Last Modified: 2013-11-20
hi

how to convert the following code into vc++.

<?php
$data_file = "payload.bin";
   if ( $fd = fopen ($data_file, "rb") ) {
          $test_kbytes = 128;
          $contents = fread ($fd, $test_kbytes * 1024);
         echo "<!-- $contents -->";
         fclose ($fd);
      } else {
      die("could not open payload file");
  }
?>
0
Comment
Question by:jyothiB
1 Comment
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 65 total points
Comment Utility
#define MAX_BUFF_SIZE 128*1024

CString csFileName("payload.bin");
char szBuffer[MAX_BUFF_SIZE];
DWORD dwSize = MAX_BUFF_SIZE;

CFile oFile;

if ( oFile.Open(csFileName, CFile::modeRead|CFile::typeBinary) )
{
      oFile.ReadHuge((void*)szBuffer, dwSize);
      
      // Trace it using TRACE macro or use MessageBox
      
      oFile.Close();
}
else
      AfxMessageBox("could not open payload file");

i believe "rb" in PHP is read binary...right?
if yes "CFile::typeBinary" is correct, otherwise remove that part

Good Luck
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now