C# :: Detecting CD-ROM Drive And Grab Filepath Of Only CSV File

Jul 8, 2014

I would like the user to insert a CD into their computer and click on an button on my application that allows them to read the CD-ROM and find a specific file type, e.g. csv, and then grab the info in the csv file.

I already have my StreamReader setup grabbing a filepath.

Now I am just wondering...how do I detect the CD-ROM and how do I grab the filepath of the only CSV file on the CD-ROM?

What's behind detecting a CD-ROM and grabbing a specific file type from a CD-ROM?

I heard about DriveInfo

However, that only allows me to detect a drive but not look at it's contents.

View 14 Replies


ADVERTISEMENT

Visual C++ :: Grab Special Lines From A File

Nov 28, 2012

I have a file that contain different content, some lines inside that file looks like that :

Time : xx:xx:xx
Time : xx:xx:xx

So, I want to grab lines that start with "Time : " and put them inside a list<string> for later use. I am using windows so I don't know if the newline character is '
' or '
' also I don't want my grabed line contain any special character.

I have this code, but didn't work well because some special characters remain inside the string.

Code:

string buf;
list<string> ls;
ifstream read("test.txt", ios_base::binary);
while(!read.eof())
{
getline(read,buf,'

[Code]...

View 1 Replies View Related

C++ :: Getting A File From Designated Location / Grab Value And Make Calculations

Oct 30, 2013

My project is to get a file from a designated location in my computer and not just read, but grab the values from the user and make a count, sum, and average calculation of the numbers in my code. I am using the fstream library and I am trying I did do it, I got the values and calcualated them, however I want the values to be accessed from maybe my desktop or my drive, I want to know how to manipulate my code to get a path like C:UserDesktop and maybe executed from the path input or given. I dont know if this is possible, or easy to do. ALso I did copy some of this code from my teachers examples and I dont know exatly why the variables have to be initilized at zero, and I would like to know a little more on the Bitwise right shift breaker used in line 20 something.

Here is my code below.

#include <iostream>//For avergae functionality
#include <fstream>//For the file commands, such as ifstream and the Bitwise right breakers(<< and >>).
#include <iomanip> // To control the amount of decimals in my results desired.
using namespace std;
int main () {
int aNumber=0; //Initilized at zero because of Stack Overflow:

[Code] .....

View 2 Replies View Related

C# :: Saving Excel File In D Drive New Folder?

Jul 17, 2014

I am trying to save the excel file in D:/newfolder. but the file saving as newfolderFilename. The newfolder is already created in D drive. File save path i am getting from textbox ....

View 14 Replies View Related

C/C++ :: Read CSV File From Flash Drive (Ubuntu 12.04)

Mar 26, 2013

I want to read a file from my flash drive called text.csv. However, I cannot even open the port where my flash drive is connected. This is the code that I am using, but I get error since the first part. When I run the program it says "fopen Error". I am using Ubuntu 12.04.

#include<stdio.h>
#include<string.h>  
#define SIZE 1
#define NUMELEM 5  
int main(void) {
    FILE* fd = NULL;

[Code] ....

View 1 Replies View Related

C# :: Mapped Network Drive - Deleting Or Moving A File

Sep 16, 2014

Currently I'm trying to do something extremely basic: delete or move a file

I have a mapped network drive (Y) where I have a file I need to move from one folder to another

First was doing the obvious:

System.IO.File.Move("Y:TempFile.txt", "Y:Temp2File.txt");

Not much to go wrong here, right? As long as I have the correct permission to write in the folders and the folders exists, this would normally go smooth. But for some reason it only copies the file. The source file still exists, but it has successfully copied the file to the destination folder. No exceptions has been thrown or anything... but the file still exists in the source directory

I then changed the code to the following:

System.IO.File.Copy("Y:TempFile.txt", "Y:Temp2File.txt");
System.IO.File.Delete("Y:TempFile.txt");
Console.WriteLine("See mommy, no Exceptions");

As expected the file copies correctly, but the delete command is completely ignored. The file is not deleted, but the Console.WriteLine command is called

I'm running the application as the logged in user. The user has permission to delete the file. If I try from Windows Explorer, the file is correctly deleted. Unfortunately my application refuses to delete the file and even worse, it will not even throw an Exception.

View 10 Replies View Related

C Sharp :: How To Save Filepath In Textbox By Using OpenFileDialog

Nov 21, 2012

how to save the filepath in textbox by using OpenFileDialog

View 1 Replies View Related

C Sharp :: Copying A File From Current Directory To System Drive

Feb 8, 2014

I have tried to use File.Copy and File.Move but non of them would work as I expected .....

View 1 Replies View Related

C++ :: Create A Program That Is Able To Save Database Of Items To File On Hard Drive

Mar 18, 2013

Write a program that is able to save a list of items such as books, CDs, or DVDs and the items that are saved must have attributes associated with them. For example a book has a title, author, publisher, and ISBN.I would like to create a program that is able to save the database of items to a file on the hard drive and also retrieve it from the hard drive.I have this for a start of how to set up a storing program.

#include <iostream>
#include <iomanip>
using namespace std;
int main () {
const int arraySize = 10;
int a[arraySize] = { 2, 6, 4, 10, 12, 89, 68, 45, 37 };
int i, hold;

[code]....

View 2 Replies View Related

Visual C++ :: Grab Screen(s) And Invert Their Brightness

Jan 15, 2014

I have a visual impairment that makes it very hard for me to use the standard dark text on white background themes. I use High Contrast but many apps don't query the system for colors (I.E. aren't theme-aware) and consequently display pale or dark text on a white background regarding of the theme selected.

There is a product called ZoomText that allows for inverting the brightness of everything being displayed. I just use a normal theme, let all apps display naturally, and then invert the entire screens brightness.

But ZoomText doesn't support multiple monitors. And it does a lot more than I need. And it hogs the CPU. And it costs a lot.

Looking for some of the APIs that I need to capture the bitmaps for all monitors, invert the brightness of all pixels, and refresh the display contexts. And make that happen so smoothly that it appears like there is nothing going on behind the scenes. (DirectX, OpenGL, ???)

View 4 Replies View Related

C++ :: Detecting TR1 Support?

Feb 3, 2012

I have source code that is shared between two compilers, one supports TR1 and one doesn't. I've reverse engineered a few of the TR1 templates for the older compiler, but I need to be able to detect whether TR1 is supported or not, so as to include the correct header.

Something like this.

Code:
#ifdef SUPPORTS_TR1
#include <array>
#else
#include "mystl/array"
#endif
std::array<int, 10> myarray;

The compiler that supports TR1 is Visual Studio.

View 2 Replies View Related

C# :: Detecting Previous Installs?

Jul 16, 2014

Say a user installs and uses the software for awhile. Then they uninstall it. Client wants the database containing client data to remain behind, in case they ever re-install the software. Which is fine.

So then.. they re-install the software. Client wants them to have the choice to either use the existing database, or to create a new one. When the software fires up, it always checks for the database, and creates one if it's not there. So how can I determine if the instance is a new install, or a current install, given that the database will be there no matter what?

View 7 Replies View Related

C++ :: Detecting Mouse Clicks With Direct2d

Jan 21, 2014

I have a direct2d application and I want to be able to detect mouse clicks. One example is, (in my borderless window) I would like to have an X at the top right of the screen, that when clicked would close the window. How can I do something like this?

View 3 Replies View Related

C :: OpenCV And Detecting A Person With A Webcam

Jul 2, 2013

Code:
#include "opencv2/video/tracking.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"

#include <stdio.h>
#include <stdlib.h>

[Code] ....

The above code is all I have so far. I got confused when I got to the part where my book on C tells me I need to use the cvCalcOpticalFlowFarneback() function to compare 2 consecutive images from the webcam and create the optical flow, and then measure movement between the frames to detect whether or not a person is moving through the room. How to do this, and the OpenCV wiki wasn't very descriptive on how to set it up for beginners. Honestly, the parameters just confused me and I didn't see a return value listed, or how you would get data from it.

View 8 Replies View Related

C :: Detecting Number Of Uppercase Letters?

Mar 20, 2014

Just wrote this extremely simple program but it seems to be malfunctioning. It counts correctly the number of uppercase letters in a string so long as i don't use the space-bar. once I add a space it only counts the number of uppercase letters of the first word..

printf("I ..........ing love programming");

Code:

#include <stdio.h>
main()
{
char text[200];
int i = 0;
int uppercase = 0;
printf("Enter text:");
scanf("%s", text);

[code]....

View 6 Replies View Related

C++ :: Overflow / Underflow Detecting Functions

Sep 15, 2014

I am performing arithmetic operations on very large integers that operate around the threshold of the maximum positive integer an int variable can handle (i.e. 2147483647) for a 32-bit machine. I have been studying the in-built functions in the C++ Standard Library for some time now where I came across some error detecting functions in the <cmath> and <cerrno> header files. The impression I got from the literature is that they are solely used in conjunction with functions contained in the <cmath> header file and not necessarily with fundamental arithmetic operations like addition and subtraction.

I need a means to know when my arithmetic operations generate overflows/underflows! Is there any way I can adapt the functionalities of these functions to my needs?

View 5 Replies View Related

C# :: Using Linq To Get DriveInfo Of ONE Drive

Jul 23, 2014

I want some simple code which will return only the DriveInfo from one drive. I have the below code but it isn't displaying what I expect it to display, I have a feeling i'm using Linq wrong!

var dname = from n in System.IO.DriveInfo.GetDrives() where n.Name == "F" select n.VolumeLabel;
richTextBox2.AppendText(dname.ToString() + "
");

The above should return the devices VolumeLabel which is in port F.

Instead I get the following:

System.Linq.Enumerable+WhereSelectArrayIterator`2[System.IO.DriveInfo,System.String]

View 5 Replies View Related

C++ :: Presence Of A Folder In A Drive?

Dec 15, 2012

using C++ how can i check the presence of a folder in a drive.

The path of the folder is available in a std::string like std::string path = "C:TestFolder";

View 3 Replies View Related

C++ :: Detecting Any Key Of Keyboard And Mouse On Windows / Linux?

Jun 20, 2014

I am trying to detect keys pressed on a keyboard and mouse on both, Windows and Linux but I am unsure what would be the best practice way to do so. Will I have to detect the keys for each platform individually? Would you make use of an event listener? What's the best way to detect the input-devices?

View 1 Replies View Related

Visual C++ :: GetTextExtent Not Detecting Font Size

Jun 3, 2013

I need use GetTextExtent and I don't understant why GetTextExtent always return the same value if I change some values of the selected font. This is my example:

Code:
LOGFONT lf;
pOldFont->GetLogFont(&lf);
CString sExampleSizeByChar;
sExampleSizeByChar = _T("hello");
DWORD dwPixelsByChar = dc.GetTextExtent(sExampleSizeByChar).cx / 1.15;

[Code] ....

Why I get always the value 24 when I call GetTextExtent if I change the font size?

View 3 Replies View Related

Visual C++ :: Detecting Garbage Chars In CString

Feb 1, 2013

How do I detect garbage chars in a CString. Actually I'm reading some data from COM port. In some certain condition it will give some garbage as a version no. Now I need to show _T("N/A") in case of there is any garbage.

My solution is to check for a Valid char or integer. If found its correct else Garbage.

View 11 Replies View Related

C++ :: Detecting Application Startup And Exit Events?

Apr 20, 2012

I have written ( using VS2008 c++ ) a windows service which sends information about PC usage to a central database, as part of a PC availability setup. I have been asked to add the following functionality to it:

1) What applications are most used, when and how long for, and

2) What web sites are being accessed, again to find the most popular etc.

My main question is, what functionality is there to trap application start / close events from within my service ( just need the application name ), and secondly I am already using sockets to send information to a PHP script on a server, the best way to see what web pages are being accessed is to build in a packet sniffer, and extract the information from that.

View 6 Replies View Related

C++ :: Safely Eject USB Drive (In Windows)

May 7, 2014

I would like to be able to safely eject a USB drive (in Windows) when user selects that drive in a listbox and clicks the Eject button in an MFC dialog app. Any functions or (link) that would be up to date (i.e. compatible with Windows 8)?

View 1 Replies View Related

Visual C++ :: Partitioning USB Flash Drive?

Dec 9, 2014

I have written some code to make two partitions in USB flash drive. When I ran it I am not able to make partitions on usb. What'll be the problem in this code.

Code:
/-------------------INITIALIZE AND PARTITION-------------------------------//
#include "stdafx.h"
#include <Windows.h>
#include <stdio.h>

[Code].....

View 3 Replies View Related

C/C++ :: Writing To Specific Sector In Flash Drive

Apr 22, 2015

I am trying to write a to a specific sector in a flash drive. The problem is that it will only allow me to write to sectors 0 to 15. When I try sector 16 or higher nothing happens, but in sector 0 to 15 is is working fine.

#define BUFFER_SIZE 512
int main(void) {
FILE *volume;
int k = 0;
long long sector = 0;
char buf[BUFFER_SIZE] = {0};

[Code] .....

View 14 Replies View Related

C Sharp :: Detecting Mouse Button Down And Up Events On The System Menu Of Form

Feb 16, 2014

How do I detect left mouse button down and up events on the 'Close' option of the system menu that appears when the mouse is clicked on the top left corner of a form?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved