what is happening is once it goes through all the sub-directories in the first folder, it goes right back into it. Also when it approaches a file that isn't a directory, it doesn't pop out of the stack, instead it adds the name of the next file to the path and tries to open that. How do i test if the current path is a directory using only standard c/c++ calls. Can't use boost or wxWidgets.
am trying to create a service that will try to create a service that will monitor a folder. Whenever a new file gets created, I am trying to read the contents of new file and copy contents (with same file) at a new location.
The problem I am facing is that only first file that gets its name copied and a file created at a new location, but without any contents. The subsequent files do not get created at all.
My Services.cs looks like this:-
public partial class Service1 : ServiceBase { public Service1() {
I'm trying to display the contents of this map. I'm having some trouble where the program ceasing to display after "Index Contents."(lines 33 -40) If I move the display for loop right where I'm inserting the values (line 52) into the map I get output. I'm not sure where bug is.
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 having trouble deleting a character inputted by the user recursively..
1- Should I be doing it this way where it returns the character one by one to the console?
2- Is there a way actually rebuild the string to "delete" these occurances of the key?
//This program deletes a character inputted by the user recursively #include <iostream> using namespace std; char find (char *a, char key)//Function gets passed array (but makes it a pointer) and key
So I insert values from a vector into a list and into a multiset, and I noticed zero is added to their contents! I had to do a whole lot of debugging to find out where the error was, how can i stop this thing? Code which generates such error...
infact i checked the content of vector ups to be sure that there was no zero in it, but after loading into list combi_t * head, it seems like there was a zero added and this is giving me errors when i call function master_roller...
Code: void ins(combi_t * &testa, int &numero, int &num, int &no) { // if (ricerca(testa, numero) == 0) //{ combi_t *temp = new combi_t;
suppose that the class LinkedBag did not have the data member item_count_. Revise the method getCurrentSize so that it counts the number of nodes in the linked chain a. iterartively b. Recursively[
LinkedBag.h template<class ItemType> class LinkedBag : public BagInterface<ItemType> { public: LinkedBag(); LinkedBag(const LinkedBag<ItemType>& a_bag); LinkedBag<ItemType>& operator=(const LinkedBag<ItemType>& right_hand_side); virtual ~LinkedBag();
I am creating a Linear linked list in c++. I've written all the functions for it, but now I want to try and do them using recursion.
I managed to make functions for adding and displaying nodes on the list, but I am stuck on the function for removing nodes. First I want to try and write a function the removes the last item on the list. But for some reason my code isn't working properly.
NODE - My structure name NEXT - The pointer to next element. HEAD - The first (head) pointer.
The couts in the if statements are just for testing. In fact after I Run my program it does as it is supposed - enters the second if /b]case as many times as there are elements and then executes the first [b]if statement. But for some reason it does not delete the actual node.
I'm trying to implement a code that recursively calls itself and prints the given digits in ascending order, i.e. if the number is 5, then the function will print 1 2 3 4 5. I cannot use loops in any way!
The problem I have is with keeping my variable i at a set value each time the function calls itself.
void print_ascending(int n){ int i = 1; if(i < n) { printf("%d", i); i++; print_ascending(n); } }
Of course, the problem with this code is it will re-initialize the variable i to 1 every single time and infinitely loop to print 1.
I'm currently working on a Scheme Interpreter written in C. I'm trying to create a cons cell structure via recursive descent parsing, except instead of just having the car and cons, I also have a field that holds the token that I receive from the lexical analyzer (which was provided to us). The struct for what I'm describing is as such:
typdef struct node node; typedef node* list; struct node { char* symbol; list car; list cdr; };
Thus a cons cell would be (with a node represented as [symbol][car][cdr]), [null][car][cdr], while a symbol would be [symbol][null][null].
In the top answer for a similar question on Stack Overflow, one of the suggestions was to put the tokens into a stack as the input is recursively parsed, and then from that stack input it into the cons cell structure.
This is something that I'm working towards now, as it is easier for me to understand and I already have implemented a stack in C before, but I know that I can just build the structure recursively, I'm just not sure how. The following is code that I have:
list s_expression() { list local; list temp; if (strcmp(token, "(") == 0) { strcpy(token, getToken());
[Code] .....
s_expression is supposed to return a pointer to a recursively built cons cell structure. I'm just having issues figuring out when to call getToken(), as I either call getToken in the wrong spot and unintentionally skip over a token, or I call getToken() when I'm done getting all of the tokens, thus causing my program to continue searching for a token from user input instead of continuing on with the rest of the program.
When should I be calling getToken()?
In addition, what would be better, recursively building the cons cell structure as you go through the user's input, or putting all of the tokens into a stack and then building the cons cell structure using that stack?
If needed, I can post the lexical analyzer that's been provided to us. Also, for S_expression(); showing up as S_exp<b></b>pression();, I'm not sure what happened there. I copied this post from my question on stack overflow.
I want to make a launcher for my program but the installation folder is different from one computer to another so I need a function or something that shows the path of the executable file.how to import a file from another folder.
#include<stdio.h> int main(void) { FILE *fp; *fp=fopen("C:Documents and Settings...something.txt","r"); }
I had wanted to make a program that will tell someone how many files there are in a folder and its subfolders with a certain extension. I am not sure how to find the files.
I am using dir object from dirent.h to read files of a folder. The code I am using in order to read all data is the following:
vector<string> directories;
DIR *pDIR; const char * c = path.c_str(); struct dirent *entry;
[Code]....
I am wandering when I am trying to read two times the files of the same folder, it will be stored with the same order or every time I ll read in folder it ll return different file order?
I want to rename all files in a folder (exactly I want to change extension file example:"FILE0001.CHK" to (FILE0001.JPG)), i know rename function , but how to use it all files, files names going sequencely (FILE0001.CHK,FILE002.CHK until FILE3000.CHK) ... How i can rename or change extension file quickly and easily.
im trying to write a file to a default document folder..something like...
FILE* file; file = fopen("%docdir% est.txt", "w"); fputs("Hello", file); fclose(file); "%docdir% est.txt" this isnt working for me, i have to write it as "C:userspublicdocument est.txt"
any method to write directly to default document folder so it will work in most Windows ? for example in windows 7 this is the default folder "C:users publicdocument est.txt" in windows XP its different
i have to detect the windows version first, to write the correct path
This question is currently only for windows; but I would like to know about a cross-platform way to perform what I want to do (explained below) -
I have created a little program:
#include <iostream> int main(int argc, char *argv[]) { for (int i = 0; i < argc; ++i) { std::cout << argv[i] << ' '; } }
I have added this program to the windows PATH. I put this program in C:Program FilesProgram
I now navigate to C:DataVariousTexts using CMD.
Then I type in: "program x"
The program will print out "program x" as by default. What I would like to get hold of is the folder in which the program is actually being called. ( I want to somehow get "C:DataVariousTexts" to be read into my program ).
storing images in database as well as in folder...Images are loaded FROM URL...and after that i want to display Images from folder which is in given below code: but this code is not running...it shows sql connection problem.....but connection is perfect...This code runs properly but it doesn't shows the images from folder...and It doesn't save the images...
using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI;