473,386 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

howto convert void* to picture?

i`m trying to get image from scanner throw dll (c++), which returns data in void * type.

so googled.. i found:

Expand|Select|Wrap|Line Numbers
  1. Marshal.Copy(new IntPtr((byte*)result.buffer), byte_arr,0, size);
  2.  
How can i get size of this ?

thx
May 7 '10 #1
2 1721
tlhintoq
3,525 Expert 2GB
i`m trying to get image from scanner throw dll (c++), which returns data in void * type.
I'm going to suggest you stop right now, and read up on C++. It's going to be very hard for you to do this if you don't understand the language you are trying to work with.

* is not a type. * is a pointer to the memory space of the variable.

int bob = 5;
*bob is a pointer to bob

so googled.. i found:
Expand|Select|Wrap|Line Numbers
  1. Marshal.Copy(new IntPtr((byte*)result.buffer), byte_arr,0, size);
You found some random piece of code that happens to have an * in it? Is this random line of code actually related to your scanner, or just something from someplace that seemed promising but totally unrelated?

Have you read up on what Marshal is or does? Or are you hoping it works without understanding?
May 7 '10 #2
RedSon
5,000 Expert 4TB
Here is how it probably works: This is a complete guess because the information in your question is almost totally useless.

The scanner's driver will manipulate the scanner hardware to scan your image or paper or whatever you put on it. The driver probably takes that data and puts it in a byte array buffer. The bytes probably represent some kind of color and pixel position data. The scanner driver puts this information in a buffer somewhere and then goes "hey, programmer, here is a *pointer* to the location in memory where I stuffed that data that describes whatever you just put on my scanner bed."

It is then your job as the programmer to use that *pointer* (now keep in mind a pointer is just an address location to somewhere in memory) to access that area in memory and then do whatever you want to do with it. Make a copy, change some bits around, save it to a database, whatever you want.

If you don't know how to access that pointer, or area in memory, and you don't know what to do with the data once you have that pointer then it's going to be real hard to continue.
May 7 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Randell D. | last post by:
Folks, If I have a numeric array similar to the following: $tmpArray="alpha"; $tmpArray="beta"; $tmpArray="charlie"; I can break it down like so
6
by: Tim Streater | last post by:
I want to generate a web page using PHP, and in the middle generate a graphic I read from another server. So the graphic is in $picture. So I can either write $picture to a temp file and then use...
2
by: Krish | last post by:
Hi, How to convert "1283912839E-5" string (in scientific format) to a decimal. Convert.ToDecimal("1283912839E-5") is throwing "Input string is not in correct format" exception. Is the...
1
by: Gopinath Varadharajan | last post by:
Hi, If anyone knows how to convert a input xml (getting from a url querry) and convert it into a flat, csv text file ?? Thanks, Gopi
4
by: CSharpener | last post by:
This should be *so* easy! How do I convert a Byte or int to a binary string representation in C# In JavaScript, it goes like this for an int: javascript:(123).toString(2 or...
5
by: kevinniu | last post by:
Hi everyone, In c#, what is the fastest way(include unsafe) to convert a array of bytes(which really contains the bytes of a double array) to a arry of double. thanks
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.