Program line counter

Started by
9 comments, last by The C modest god 17 years, 7 months ago
I have installed program line counter for visual CPP 2003 I have both an adminstrator user and a normal non adminstrator user. The problem I see the PLC only in the adminstrator and not in the normal user. Why is that? I didnt see an option to select users to install PLC, it just installs itself and thats it. How do I solve this? Thanks in advance.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
Advertisement
You may need to install for each account.
Semi-derail: I've been trying to find a good line counter for Windows without first installing Cygwin. I use sloccount on OS X.
Quote:Original post by Ravuya
Semi-derail: I've been trying to find a good line counter for Windows without first installing Cygwin. I use sloccount on OS X.

Semi-ad: I wrote one quite a while ago to get some C#/.NET experience. Back then I hadn't yet decided upon a clean coding style, so the code is somewhat messy. I also have a lot of features I would like to add to it when I get time (like auto-scanning directories for source files and support for more project files), but it still counts lines pretty well.

You will find the line counter at my downloads page.
[s]--------------------------------------------------------[/s]chromecode.com - software with source code
In response to the semi-derail (though it may help the OP as well) - I have used and been happy with Source Monitor. It's a stand-alone app (rather than a VS plugin), but it displays a whole heap of statistics beyond the number of lines in a program, and gives you different graphs and whatnot of each metric and how it varies over time, which is nice.
Quote:Original post by Oluseyi
You may need to install for each account.

I can't, thats the whole point of user account. You cant install stuff.

It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
Depending on Windows version, you may be able to right-click on the installer as the unprivileged user and Run As the administrative user.
Quote:Original post by The C modest god
Quote:Original post by Oluseyi
You may need to install for each account.

I can't, thats the whole point of user account. You cant install stuff.


Run the installer with elevated privilages when in the user account.
www.aidanwalsh(.net)(.info)
Quote:Original post by aidan_walsh
Run the installer with elevated privilages when in the user account.

Pretty sure that wont work. IIRC that will just act like you've logged in as the user and installed it that way which will lead to it being reinstalled under the admin account.
Don't Temp Fate..
Because I'm bored...

#include <tchar.h>#include <windows.h>#include <strsafe.h>#include <conio.h>const int ReadFileScanningCR(const TCHAR * const fileName){	int lineCount = 0;	HANDLE fileHandle = CreateFile(		fileName,		FILE_ALL_ACCESS,		0,		0,		OPEN_EXISTING,		0,		0);	if(fileHandle == INVALID_HANDLE_VALUE) return 0;	const int MY_READ_BUFFER_SIZE = 32;	char fileBuffer[MY_READ_BUFFER_SIZE];	DWORD actualReadBytes = 0;	while(ReadFile(fileHandle, fileBuffer, MY_READ_BUFFER_SIZE, &actualReadBytes, 0))	{		for(DWORD nextChar = 0; nextChar < actualReadBytes; nextChar++)		{			if(fileBuffer[nextChar] == 13) lineCount++;		};		if(actualReadBytes < MY_READ_BUFFER_SIZE) break;	};	CloseHandle(fileHandle);	return lineCount;};const int ScanFiles(const TCHAR * const filePath, const TCHAR * const fileExtensionToSearch){	int lineCount = 0;	TCHAR completeFilePath[MAX_PATH];	StringCbCopy(completeFilePath, MAX_PATH * sizeof(TCHAR), filePath);	StringCbCat(completeFilePath, MAX_PATH * sizeof(TCHAR), _T("\\*.*"));	WIN32_FIND_DATA FindFileData;	HANDLE findHandle = FindFirstFile(		completeFilePath,		&FindFileData);	while(findHandle != INVALID_HANDLE_VALUE)	{		StringCbCopy(completeFilePath, MAX_PATH * sizeof(TCHAR), filePath);		StringCbCat(completeFilePath, MAX_PATH * sizeof(TCHAR), _T("\\"));		StringCbCat(completeFilePath, MAX_PATH * sizeof(TCHAR), FindFileData.cFileName);		if(FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)		{			if(FindFileData.cFileName[0] != _T('.')) // do not process "." and ".."			{				lineCount += ScanFiles(completeFilePath, fileExtensionToSearch);			};		}		else		{			// confirm extension matches			bool fileMatchesExtension = true;			size_t extLen = _tcslen(fileExtensionToSearch);			size_t fileNameLen = _tcslen(FindFileData.cFileName);			while(extLen > 0 && fileNameLen > 1)			{				extLen--;				fileNameLen--;				if(FindFileData.cFileName[fileNameLen] != fileExtensionToSearch[extLen])				{					fileMatchesExtension = false;					break;				};			};			if(fileMatchesExtension)			{				// basically extension must be is ".something", otherwise situations where				// extensionless files such as "myfilecpp" will be scanned.				if(FindFileData.cFileName[fileNameLen-1] == '.') 				{					_tcprintf(_T("Scanning File: %s\n"), completeFilePath);					lineCount += ReadFileScanningCR(completeFilePath);				};			};		};		if(FindNextFile(findHandle, &FindFileData) == 0) break;	};	FindClose(findHandle);	return lineCount;};int _tmain(int paramCount, TCHAR ** paramStrings){	if(paramCount != 2)	{		_tcprintf(_T("Please specify one parameter only, the source path\n"));		return 0;	};	int lineCount_h = ScanFiles(paramStrings[1], _T("h"));	int lineCount_cpp = ScanFiles(paramStrings[1], _T("cpp"));	_tcprintf(_T("\nTotal \"*.h\" lines: %d\n"), lineCount_h);	_tcprintf(_T("\nTotal \"*.cpp\" lines: %d\n"), lineCount_cpp);	_tcprintf(_T("\nTotal overall lines: %d\n"), lineCount_h + lineCount_cpp);	_tcprintf(_T("\npress any key to continue...\n"));	getch();	return 0;};

This topic is closed to new replies.

Advertisement