Solved

how to write in vc++

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
while loop over for loop 7 101
ShiftLeft challenge 21 80
Is there a simple front-end menu system. 9 88
JQuery serialize and unserialize 8 77
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

785 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