Solved

how to write in vc++

Posted on 2003-11-05
1
215 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 65 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

623 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