Solved

how to write in vc++

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 28
Expand LInux Boot partition remotly 3 85
method notes when mouse over in eclipse 5 82
format the code in java 6 86
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

932 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

15 Experts available now in Live!

Get 1:1 Help Now