?
Solved

how to write in vc++

Posted on 2003-11-05
1
Medium Priority
?
222 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 195 total points
ID: 9692488
#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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

719 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