🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #8117

Re: Q: How to read a diskette's ID-No. (Volume Serial Number)

#8117
From: Fred Smith
Date: Tue, 03 Mar 1998 00:00
47 lines
1759 bytes
erik.rasmussen@leo.dk wrote:
: How do I write a C++ (MSVC++ v.5)  program that retrieves the unique
: ID-number (i.e. the 'Volume Serial Number' as shown by a 'DIR A:' 
: command) on a floppy disk?
: I prefer an MFC solution.
:  
: Kind regards 
: Gustav Sporon-Fiedler,
: LEO Pharmaceutical Products, Denmark
: e-mail: gustav.sporon-fiedler@leo.dk

A hack:

#include <stdio.h>
int main (int argc, char ** argv)
	{
	FILE * infile;
	char buf[128];

	sprintf (buf, "dir %s > delete.me\n", argv[1]);
	system (buf);
	if ((infile = fopen ("delete.me", "r")) == NULL)
		{
		printf ("oops\n");
		exit (0);
		}
	while (1)
		{
		if (fgets (buf, sizeof (buf), infile) != buf)
			{
			break;
			}
		if (strstr (buf, "Volume in drive") != NULL)
			{
			printf ("%s\n", buf);
			break;
			}
		}
	fclose (infile);
	unlink ("delete.me");
	}
--
---- Fred Smith -- fredex@fcshome.stoneham.ma.us -----------------------------
                      The eyes of the Lord are everywhere, 
                    keeping watch on the wicked and the good.
----------------------------- Proverbs 15:3 (niv) -----------------------------
Technical Details
Message-ID: <Ep7vrq.G63@fcshome.stoneham.ma.us>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <MPG.f649d74f5abdf7398969a@balder>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10f6aa,b5c1243e77fb9c8b
X-Google-Attributes: gid10f6aa,public
X-Google-Thread: fa6f6,b5c1243e77fb9c8b
X-Google-Attributes: gidfa6f6,public
From: fredex@fcshome.stoneham.ma.us (Fred Smith)
Subject: Re: Q: How to read a diskette's ID-No. (Volume Serial Number)
Date: 1998/03/03
Message-ID: <Ep7vrq.G63@fcshome.stoneham.ma.us>
X-Deja-AN: 330330192
References: <MPG.f649d74f5abdf7398969a@balder>
Followup-To: comp.os.msdos.programmer,dk.edb.programmering
Organization: None!
Newsgroups: comp.os.msdos.programmer,dk.edb.programmering