I'm new to program breadth first search and for my assignment we have to implement a breadth first search graph and output the order of the traversal. The problem is when I run my program I do not get any output from my traversal. All I get is "Breadth First Search Traversal starts at Vertex 2 and the order is: "
Here is my Queue class
//Declaration of node struct node{ int info; node *next; }; //Defining Queue class class Queue{
In this program what i'm doing is to search for a number when the vector is in order, and count how many times that number appears, the problem is that count how many times the number does not appear, but when its appear the program stays in an "standby mode" and the cursor does not move.
int buscarNumOrdenado (int x [MAX]) //MAX is the define { int num,d, LimiteInferior, LimiteSuperior,mitad; d=0; LimiteInferior = 0; LimiteSuperior = MAX-1;
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
inputting a search array. I tried putting a binary search but I can't get it to work. everything else works up until I put the value I am searching for in the array, then it just crashes.
How it suppose to work: input 2 coordinates with a value each then it calculates the distance between them then it suppose to let user search the coordinates for a value and state if found which coordinate it is at.
How do you create a new directory in C++? I would like to do this using the standard library and no external, third party or non standard libraries/headers. I need to do this without calling system() or system("mkdir").
How to change directory in c++ ( windows ) I want to go to the folder "example2" and I delete some files and then return to the original folder c++ - windows
My application is processing a large amount of data (approx. 50 - 100 GB of txt data). given the machine regular user usually has, my app is writing some tmp data into a local tmp directory. and this is working just fine until users get comfortable with my software and start changing that content of local tmp dir (while the program is running). which does not give any problems like crashing a program if handled at the right time but produces wrong results in the end. now this is not my problem but i would still like to somehow restrict users from even peeking into the tmp dir. I am just tired of getting emails saying my software is cr.... (maybe it is but i don't think it is because of that)
So is it possible to somehow encrypt the entire dir so that only the program has access to it . it would be even better if the dir could look as some encrypted index file so that when user sees the warning :
I want to obtain the user's home directory. I know it can be done with getenv("HOME"), but if I'll inspect the value of the enviroment variable HOME, it might work when I run it now, but it won't work on Windows, since windows uses HOMEPATH to save the user's home directory.
Is there a different, more cross-platform way to do it?
I'm writing a program to merge all .txt files in a directory. I had the code working and then made small change. It started crashing and I couldn't get it back to working.
If I comment that section out, the code still works. But, I know that portion of the code works to copy text from one file to another! It's actually from the Schildt complete C reference and I have tested it several times on it's own.
I need my Unix program to generate a directory with a format like this: "hinesro.<pid>". I have some code that mostly works, except for the directory ends up with a question mark on the end, like this: "hinesro.12345?". I need it to just display the directory without this question mark. Here is my code:
Code:
// Using headers sys/types.h, sys/stat.h, unistd.h, and stdio.h int pid = getpid(); char prefix[] = "hinesro."; char fileName[0]; sprintf(fileName, "%s%d ", prefix, pid);
Error Message: $ ./dirsearch ~/Documents/College/textfiles/ [..] [yomama.txt] Error : Failed to open entry file - No such file or directory
Here are my current file permissions: textfiles$ ls -l total 8 -rw-rw-rw- 1 jav jav 7 Apr 26 13:14 moretext.txt -rw-rw-rw- 1 jav jav 10 Apr 26 12:38 yomama.txt
I tried listing files using the code given in "[URL] ..." the program listed all the files present in the current dirctory but if i change the drive and the directory to such as
"C:UsersBaaooDownloadsdirect.h function"
the program does not list files name.
#include <iostream> #include <dirent.h> using namespace std; int main() {
Taking a OS course and my professor gave us files to reference in a directory located at ~agw/class/os/share/proj3. But when I typed this into the terminal I keep getting a permission denied error message.
[lastname@erdos ~]$ ls dead.letter Desktop Documents Downloads Music Pictures private Public public_html Templates Videos [lastname@erdos ~]$ ~agw/class/os/share/proj3 /u/sobolev/agw/class/os/share/proj3: Permission denied. [lastname@erdos ~]$
I'm not sure what I am doing wrong. Ive opened shared directories for this class before and had no issues.
Taking a OS course and my professor gave us files to reference in a directory located at ~agw/class/os/share/proj3. But when I typed this into the terminal I keep getting a permission denied error message.
[lastname@erdos ~]$ ls dead.letter Desktop Documents Downloads Music Pictures private Public public_html Templates Videos [lastname@erdos ~]$ ~agw/class/os/share/proj3 /u/sobolev/agw/class/os/share/proj3: Permission denied. [lastname@erdos ~]$
I've opened shared directories for this class before and had no issues.
I'm writing a C++ module that is meant to recursively scan a directory and I'm curious what yall think of my strategy.
The program is a music player and so I'm trying to make the directory scanner as lightweight and efficient as I can. I've decided I want to scan the files in two passes- first I just want to get a list of all music files that are found in a directory/subdirectories and then I want to process the list and search for id3s/other tags.
As I'm a scanning the directory, I've decided to store the temporary list in a linked list where each node is containing an array of 100 strings. I did this because I obviously don't know how long the list will be and I from my understanding of the C++ vector class it basically just makes over sized arrays and moves them when it runs out of space. That sounded rather clunky to me, as did a traditional linked list.. I didn't see the point of allocating memory that many times in a row.
I'm using the following code to capture all files in a directory - but when I pass the "path" var such as "C:SomeDir" ffd.cFileName is just simply "SomeDir" and is seen as a valid folder and no more files are processed.. I'm trying to get the contents in that folder. I'm following this example here - [URL] .....
I am trying to substitute a variable for the file directory. Here is the error: error: no matching function for call to 'std::basic_ ofstream <char>:: basic_ ofstream(std::string&)'
I'm quite new to C++ and got a problem of reading some files from a directory. All files is pure text, and I have no problem in reading these.
My problem is that I always have to read the oldest file without knowing the filename, and then move it to another directory and so on. Is it possible to use the timestamp instead of the filename to access the right file - read it and then move it to another directory?
Convert this code into one where you can input the file directory from the console?
#define WIN32_LEAN_AND_MEAN // prevent windows.h from including "kitchen sink" #include <windows.h> #include <iostream> #include <string> using namespace std; int main() {LPCSTR Application = "C:Program FilesWindows Media Playerwmplayer.exe"; // Media file extension must be provided // Paths are quoted
[Code] ....
This code works but the directory can only be changed from the code not the console.
I'm trying to parse the root directory of FAT32 in order to get a dir list in the root folder.
So I need to go over all the directory entries in the root directory and parse them.
My problem is that I don't know when to stop the iteration - How to get the size of the root directory?
I noticed that there is a byte in the boot sector - the number of the entries in the root - but in FAT32 the value is always 0, So how can i get the size of the directory?