How to read bytes from a device using c/c++ in windows
Asked Answered
G

2

0

So here's the background:

I've got this SCSI device with media that has raw data on it (for simplicity let's say it contains abc123). This device is on a Windows machine. I'd like to use C/C++ to initalize the device, open it, send the SCSI read command to the device, and ultimately "read" the bytes.

I've searched for similar topics, but I keep getting Linux/Unix guides, or Visual C++ (which I do not have access to).

Does anyone know a good way to start this? Maybe some sample code or maybe someone has a tutorial laying around ;-)

Thank you in advance!

EDIT: I am using Cygwin.

Godliman answered 30/3, 2012 at 16:21 Comment(5)
First, cygwin is not a compiler, it is an emulator for *nix environments at best. Second, you should start by reading the Windows API as you are clearly running on Windows. But if you want to use the Windows API, I would not do that under cygwin, it adds one more layer of complexity that you clearly don't need. Try using a free Windows compiler (e.g. Mingw) Alternatively, you can download/install Visual C++ (or Studio) Express, which is freeGreenock
I realize that cygwin is not a compiler, but I am using the cygwin environment for compiling. I do not have access to the Mingw compiler either for the same reason I do not have access to Visual C++. Thank you.Godliman
Good luck to you, then. You are in it for the long haul...Greenock
Lol already been in the long haul. But if I figure it out - kudos!Godliman
@redhotspike: I suggest you ask another question: "How do I call the Win32 API from a Cygwin program?"Growth
G
0

UPDATE: After banging my head into a wall for quite some time, and some pleading and begging, I managed to get my superviser to allow me to get Visual Studio 2003 installed!

To anyone looking for more information on this topic, I highly agree with the comments provided above-it's near impossible to accomplish this on a Windows machine and not use Visual C++.

My only other suggestion is to make the wonderful switch to *nix world (if you can)!

Godliman answered 1/5, 2012 at 18:39 Comment(2)
You didn't need Visual C++ in particular, you just needed a Windows compiler. Mingw would have been perfectly adequate for the stated purpose.Growth
(And I strongly suspect that trying to do a similar task in Linux, but insisting on using Wine rather than native code, would prove just as difficult!)Growth
N
0

If you absolutely must go down to the hardware level and as far as linux is concerned you would have to use IOCTL commands, for example: http://sg.danny.cz/sg/sg_io.html

Nonresistance answered 30/3, 2012 at 16:29 Comment(1)
I appreciate this tidbit, however, as stated in my description I'm using Windows.Godliman
G
0

UPDATE: After banging my head into a wall for quite some time, and some pleading and begging, I managed to get my superviser to allow me to get Visual Studio 2003 installed!

To anyone looking for more information on this topic, I highly agree with the comments provided above-it's near impossible to accomplish this on a Windows machine and not use Visual C++.

My only other suggestion is to make the wonderful switch to *nix world (if you can)!

Godliman answered 1/5, 2012 at 18:39 Comment(2)
You didn't need Visual C++ in particular, you just needed a Windows compiler. Mingw would have been perfectly adequate for the stated purpose.Growth
(And I strongly suspect that trying to do a similar task in Linux, but insisting on using Wine rather than native code, would prove just as difficult!)Growth

© 2022 - 2024 — McMap. All rights reserved.