C++ :: Function To Search For A File In Computer

Apr 4, 2013

#include <iostream>
#include <cwchar>
#include <string>
#include <Windows.h>
using namespace std;
#include <shellapi.h>
#pragma comment(lib,"shell32.lib")
static HWND hBut;
#define ShellExecute;

[Code] ....

My function is the issue. I'm not sure how to write a correct function to search your computer for file 'a'.

View 3 Replies


ADVERTISEMENT

C++ :: Use Find Function To Search For A Line In Text File

Oct 28, 2013

I'm trying to make a program that will search for a line in a text file using a non default delimitor at the start of the line. An example line in the text file would be as follows:

F Mary Smyth, 19, United Kingdom

I have been able to use the find function to search for and return the 'F' character but would like it to then display the whole corresponding line. Is this possible with the find function?

ifstream readFromFile("data.txt");
string Destinations[1] = {"F "};
string data;
while(!readFromFile.eof()){
getline(readFromFile,data);

[code]...

View 2 Replies View Related

Visual C++ :: Search Function - Ask User To Input Name And Brings Out Line From TXT File Containing Information

Dec 8, 2013

How to get this thing to work. All i need to do is ask user to input a name and then it brings out the line from the .txt file containing the information.

For example in my case I'm doing a member search function I'm required to ask user to input the name of the customer and then print out all the details (which consumes 1 text line in the .txt file)

Here is the code, This is the write to text file method (100% working)

Code:
cout << "Customer Name: ";
cin >> name;
// ...
ofstream myfile("customer.txt", ios::app);

[Code] .....

View 3 Replies View Related

C++ :: Transfer TXT File From Computer A To B?

Aug 4, 2014

how could I transfer a .txt file from Computer A to Computer B using c++. (over LAN)

View 3 Replies View Related

C :: Program In Which Computer Will Read Txt File And Encrypt It

Jan 1, 2014

I am writing a program in which the computer will read a txt file and encypt it. The encryption works fine, but the computer cannot read the file perfectly. If there's a newline, the scanning process stops. For example I have the following text in the txt file.

One two three four five
(newline) Six seven eight

The computer will stop reading after 'five'. I assume that is because I use fgets.

View 4 Replies View Related

C/C++ :: Putting Computer Info Into CSV File - Batch Files

Dec 8, 2014

I am trying to use a combination of windows batch scripts as well a C++ program to put users data into one single .CSV file. Right now, I have a batch file that will output data from the command line into multiple .txt files. These files are mac.txt, serialnumber.txt, computermodel.txt, and computer name.txt. What I want to do, is to have users run the batch file, which will in turn run the .exe C++ file which will concatenate all their data into one file, computerinfo.csv. The file format for this file would be to have the mac address, serialnumber, computer model, and computer name all in their own column.

My main issue is that these individual files don't have the format that I would like, but based on the command prompt functions, there isn't really any good format. For example, the mac.txt file has the following format:

Physical Address Transport Name
=================== ==========================================================
xx-xx-xx-xx-xx-xx DeviceTcpip_{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
yy-yy-yy-yy-yy-yy Media disconnected
zz-zz-zz-zz-zz-zz Media disconnected

but all I really want is xx-xx-xx-xx-xx-xx

The other files have other issues with format, but if I can figure out this one then the others should be a piece of cake.

Also, I want the output of this to all go in one row, and as other users run this file, they will go into new rows without touching the rows above.

View 1 Replies View Related

Visual C++ :: Find And Open A File On Remote Computer

Feb 26, 2013

I have a file on one server(Windows 2003) and need to access from another server (IIS server - Windows 2008) , I have written the program for the same which works fine and I can access the file.

But when this comes to the DLL (which registered successfully on Windows 2008), its not able to find the file on Windows 2003.

View 15 Replies View Related

C++ :: Spell Checker - Check If Inputted Word Is In Dictionary File On Computer

Jul 31, 2013

Over the last few days, I've been trying to implement a spell checker in c++ that checks if the inputted word is in the dictionary file on my computer. However, as I'm nearing completion of the project, I keep running into more and more errors, some of which I do not understand. My program is complete, albeit, with some minor bad practices (I hard coded a few things just to get the program up and running.For some reason, everything works well until I output spelling suggestions. I type in "mses" (attempting to spell mess) and it returns some strange characters. It does definitely recognize that there are two permutations that match words in the dictionary (however they are both mess due to the algorithm implemented), and I don't understand why? I will work on removing the duplicates after.

// Spell Checker.cpp : Defines the entry point for the console application.//

#include "stdafx.h"
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <fstream>
#include <iostream>

[Code] .....

View 7 Replies View Related

C :: Function To Search If Two Given Strings Are Equal

Jul 9, 2014

I made my own function to search if two given strings in my function are equal but the problem is if i pass two variable like hello,hello ... result is string equal but if i pass hello , hello also give me string equal because last 4 characters same to last 4 characters of hello ...

Code:
int getSimilarityOfTwoStrings(const char str1[],const char str2[]){
int str1Len = getStringLength(str1);
int str2Len = getStringLength(str2);
int i = 0;
int j = 0;
bool truefalse;

[Code] .....

View 3 Replies View Related

C++ :: Binary Search Delete Function

Nov 26, 2013

I am having an issue when i try to delete a node with 2 children it either doesn't delete anything, or wigs out in various manners deleting the wrong node or replacing a node with a various memory location. As follows, here is the delete function:

void BST::dele(){
bool found = false;//initialize a bool type to "find" the element to be deleted
if(root == NULL) return;//well if the tree's empty, nothing to be found right?
current = root;//set the current to the root to traverse the tree in search of the element
node* parent;//create a parent node for use once the node has been deleted
while(current != NULL){//traverse the tree

[Code] .....

View 1 Replies View Related

C :: Strstr Function / Search And Replacing New String

Sep 23, 2013

Code:

#include<stdio.h>
#include<string.h>
#define MAX 25
int main(void)
{
int ch;

[Code]....

i think that cause this program to be error.because when i using the reference from internet, the program was executed for sure.This code what i mean

Code:
#include <stdio.h>
#include <string.h>
#define MAX 10
int main () {
int ch;
char str[] ="This is a simple string";
char str1[MAX];
char str2[MAX];

[Code]....

and rather than that i didnt have anymore idea to make that replacing string.

View 6 Replies View Related

C :: Search And Delete Function For Binary Trees

Apr 1, 2014

I had an assignment that I completed and it was just inserting values into a binary tree and then displaying it. I was wondering what the code would be if I wanted to delete a number in the binary tree, or if I wanted to search for a number. Here is my code for my assignment.

Code:
#include <stdio.h>
#include<stdlib.h>
typedef struct bt_{
int value;
struct bt_ *right;
struct bt_ *left;

[Code] ....

View 1 Replies View Related

C++ :: Linked List - Recursion For Search Function

Mar 19, 2013

I have a linkedList search function given and I am having a little trouble getting it to work. I've made a few attempts with no success. Given normal search code:

template <class Type>
bool orderedLinkedList<Type>::search(const Type& searchItem) const {
bool found = false;
nodeType<Type> *current; //pointer to traverse the list

current = first; //start the search at the first node

[Code] .....

My attempt to make it a recursive search:

template <class Type>
bool orderedLinkedList<Type>::search(const Type& searchItem) const {
//bool found = false;
nodeType<Type> *current; //pointer to traverse the list
current = first; //start the search at the first node

[Code] ....

View 3 Replies View Related

C++ :: Binary Search Tree Remove Function

Feb 14, 2014

Im working on a BST remove function. I think I'm on the right track but I'm not sure. From what I understand there are 3 possible cases. A Node with no children, one child, or 2 children(this being the most complex).

void BST::remove(int x) {
TreeNode *n;
TreeNode *v;
n= root;
while(n != NULL && n->key != x){

[Code] ....

View 4 Replies View Related

C++ :: Search Function For Speaker Bureau Program

Jan 15, 2015

I'm working on this program for homework an here is the problem:

Write a program that keeps track of a speakers bureau. The program should use a structure to store the following data about a speaker.

Name
Telephone Number
Speaking Topic
Fee required

The program should use an array of at least 10 structures.It should let the user enter data into the array, change the contents of any element, and display all the data stored in the array. The program should have a menu-driven user interface.

So I did the program which is below but now it is asking this:

Add a function that allows the user to search for a speaker on a particular topic. It should accept a key word as an argument and then search the array for a structure with that key word in the searching topic field. All structures that match should be displayed. If no structure matches, a message saying so should be displayed.

Now this where I get stuck, I'm having trouble figuring out how to write down the search function in this program. A function that can work and how to get it to match the topics listed by each speaker.

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
struct speakerBureau {

[Code] .....

View 4 Replies View Related

C++ :: Adding Search And Delete Function To Program

Jun 21, 2013

I'm trying to add a search and delete function to my program

#include <Windows.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <iostream>
using namespace std;
class Cvampire{

[Code] ....

View 4 Replies View Related

C++ :: Binary Search Tree Print Function?

Nov 2, 2014

1) how come root node is printed when the first call to function goes to left subtree?

2) How it resets to root to go to right subtree from last left tree leaf?

void bst:: printNodes(hwareItem*& root){
if(root){
printNodes(root->left);
cout<<root->barcode<<endl;
cout<<root->description<<endl;
cout<<root->price_per_unit<<endl;
cout<<root->stock<<endl;
printNodes(root->right);}
}

View 19 Replies View Related

C/C++ :: Linked List Search Function - Find Specified Value

Feb 9, 2014

I'm have troubles with this program that requires me to make a search through a Linked List and find a specified value. It also needs to be a template function. I've completed the rest of the program fine and everything runs ok except for the search function. Code below:

Linked.h
#ifndef LINKED_H
#define LINKED_H
#include<iostream>
template <class T>
class Linked {

[Code] ....

I have commented out my attempt at the search function. When uncommenting the function I get several errors about <template> being incorrect syntax.

View 8 Replies View Related

C/C++ :: Strrchr Function - Search For A String From The Reverse

Feb 27, 2014

I understand that the strrchr function is supposed to search for a string from the reverse. Unfortunately, mine isn't doing that.

#include <stdio.h>
#include <conio.h>
int main() {
char userinput[100] = "null";
char searchchar;
char *s;
char try_Again;

[Code] ....

View 5 Replies View Related

Visual C++ :: Linked List Search Function

Feb 9, 2014

The program I have below. If you copy and paste it it should work. However, When I uncomment my search function I get lots of errors and I think it has to do with incorrect syntax of it being a template. Need to do this search function:

Linked.h header file

Code:
#ifndef LINKED_H
#define LINKED_H
#include<iostream>
template <class T>
class Linked {
private:
// Declare a structure for the list

[Code] .....

View 2 Replies View Related

C :: Simplifying A Simple Linked List With Search Function

Jun 5, 2013

Code:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

struct node
{
int data;
struct node *next;

[Code] ....

It fills the singly-linked list with 0 through 9 and calls a function to prompt the user to search for a number. I don't see any glaring errors, I was just wondering what could be done to simplify it or if there's anything I missed.

View 8 Replies View Related

C :: Linear Search Function Accessing String In A Struct?

Apr 5, 2013

I currently have a file which allows inputs to record different transistor types. I then have the task of accessing this structure, find a certain manufacturer ID, and print the information about this particular transistor.

My problem is accessing the array to search through.

Here is my code:

Code:
#include "stdio.h"
const int IDLEN=30; //All constant values defined
const int POLARITYLEN=3;
const int MAXSTOCKITEMS=10;
//First structure defined
struct TransistorRec {

[Code]......

The errors I am currently getting are on line 54 'expected primary-expression before "struct"' and on line 60 ' 'maunfacturersID' undeclared'

View 11 Replies View Related

C++ :: Binary Search Tree (Iterative Function To Insert)

Jun 23, 2013

I was studying BST and tried to make a iterative function to insert, the original recursive function is the following:

void insert(node *&tree, int value) {
if (!tree) {
tree = new node;
tree->num = value;
tree->left = tree->right = NULL;

[Code] ....

And the code that i did is (but doesn't work):

void insert(node *&tree, int value) {
if (!tree) {
tree = new node;
tree->num = value;
tree->left = tree->right = NULL;

[Code] ....

I don't see where the error is or why it doesn't work.

View 6 Replies View Related

C++ :: Binary Search Tree - How To Implement Insert Function Properly

Nov 18, 2013

I am unable to implement the insert function properly, every time i run the program i just get the first value and name, I am not getting other Id's and name.

"(Header File)"
#include <iostream>
#include <string>
using namespace std;
class node{
public:
int ID;
string name;
class node *left, *right, *parent;

[Code] .....

View 4 Replies View Related

Visual C++ :: Binary Search Tree - Implementing Insert Function

Nov 18, 2013

I am unable to implement the insert function properly,every time i run the program i just get the first value and name,i am not getting other Id's and name.

Code:
"(Header File)"
#include <iostream>
#include <string>
using namespace std;
class node {
public:
int ID;
node (string StudentName, int IDNumber) {

[Code] ....

View 4 Replies View Related

C++ :: Search And Find The Shortest Queue And Search After Some Condition?

Mar 7, 2013

I am trying to implement a Task scheduler where i have n number of tasks. The Idea behind my task scheduler is that in a loop of queues of a vector, task should get enqueued to the shortest queue among the loop of queues, which is done by the following code.

#include <vector>
#include <queue>
std::vector<std::queue<int> > q
int min_index = 0;
task t // implemented in the other part of the program

[Code] ....

Next i am trying to extend this paradigm to reduce the overhead time of the scheduler, Instead of searching the shortest queue every time, search after some condition ie. search the shortest queue after 5 tasks gets enqueued to the shortest queue.

i need to do something like this

#include <vector>
#include <queue>
std::vector<std::queue<int> > q
task t // implemented in the other part of the program
while(q[min_index].size()!=q[min_index].size()+5) // check whether current min_index queue's size is increased 5 more times if not goto enqueue

[code].....

View 1 Replies View Related







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