Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6160855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:23:40+00:00 2026-05-23T21:23:40+00:00

I wanted to convert string into array of bytes . How can i do

  • 0

I wanted to convert string into array of bytes. How can i do that ?

Actually i wanted to read from the file and convert all that data into array of bytes .

If converted how can i obtain the size of that array ?

After obtaining array of bytes i wanted to get the pointer of type LPVOID and make it point to that array of bytes , to use the function BOOL WritePrinter(
__in HANDLE hPrinter,
__in LPVOID pBuf,
__in DWORD cbBuf,
__out LPDWORD pcWritten
);

The second argument demands pointer towards array of bytes . But i don’t know any method that does this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:23:40+00:00Added an answer on May 23, 2026 at 9:23 pm

    You can convert a string to a char* using

    char* bytes = str.c_str();
    

    The length can be obtained through

    int len = str.length();
    

    The pointer can simply be casted to LPVOID

    LPVOID ptr = (LPVOID) bytes;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method that converts a file to bytes so that I can
Wanted to convert <br/> <br/> <br/> <br/> <br/> into <br/>
I wanted to write a function that would take an object and convert it
i am really struggling to load some numeric floating point data from a file
How do i convert String www.mywebsite.com/firefox.txt to URL ? I wanted to use this
I'm trying to use Jackson to convert some JSON data into Java objects ,a
I have the following date string: dtstr = '2010-12-19 03:44:34.778000' I wanted to convert
In C#, if I wanted to parse out a string into a date and
How can I convert an integer returned by the read() in a BufferedReader to
I wanted some of those spiffy rounded corners for a web project that I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.