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.
I am trying to load a .bmp file located in the same folder as main.cpp etc. but I'm not sure what to input as the resource path so that it picks it up and, when I distribute it, I want it to be preferably cross platform and run smoothly.
I have tried using:
hello_world.bmp SDL_Game/hello_world.bmp (SDL_Game is the name of the project)
but it will work if I use the full path. I don't want to do this though, because then it will not work on other computers and platforms.
I want to read a folder that contains large number of tif files. (say 1000 tif images) requirement is to read all files and store in a array/array pointer.
How do i go around the code for this screensaver..
[URL] .....
I tried some examples from other people's code but it doesn't seem to work. Tried to ask the owner aswell but it doesn't seem that he would be able to reply as he's been inactive.
I need a code for renaming multiple(bulk or all ) files in a folder.
I found one batch file script but it renaming with numbers only. But i want differntly.
[URL] .....
Example:
In a folder there are 100 images and all numbered with some digits or names.
assume that all images are belongs to "john" , so i want to rename all images with "john+ a random string".
here a random string means -> it has an array with 3000 english words, (you can predefine them by downloading from dictonary).
In the script the 3000 names are fixed, but the 1st name will be changed by my wish. that my be john, mary, sai, pavan etc...
Suggestion: you do not need to enter all 3000 words in array manually. some javscript codes are there to read input of each and evey line and them into an array.
How to make a C function, that will be copying string to the clipboard?(so during execution it copies to cliboard, and after the program ends its execution I will be able to do "Ctrl-V" and paste the things copied)?.
I assume that linux have some sort of in-kernel clipboard which can be filled with some systemcall?
how I would copy a file's contents into a char buffer and copy it over to another file for files that can't be opened/read in notepad? (Example: a rar file or a .exe ) Not sure if that makes
I'm having some trouble with copying one I/O stream into another. I've put the first one into an array but I cannot get my second prompt to copy the .txt file the first prompt sees and outputs to the console. When I try and grab the info from the .txt file my first prompt sees I only see blank space in my .txt file.
#include <iostream> using std::cout; using std::cin; using std::endl; #include <fstream> using std::ifstream; using std::ofstream;
So I'm writing a function isPalindrome() that can accept a string as an argument, and copy from it only the alphabetic characters in the argument (original) string to another string named alpha_array which contains only the alphabetic characters. Then the function should be able to call the isPurePalindrome function to determine if alpha_array is an ordinary palindrome.
The problem is that when I call isPalindrome in main, the program crashes.
Here's the code I have for isPurePalindrome and isPalindrome:
Code:
/* 1 */ int isPurePalindrome( const char * sentence ) // Can accept strings, array and pointer arguments { // Declarations
I'm having trouble with this code. What I'm trying to do is to read a line from a file and cut that line into two pieces, one is the keyword and the other is the definition. I want to read up to when there is a dash and assign that line to key and then assign the rest of the line to def. After that I copy key to the struct DictEntries.key and def to DictEntries.def. The output of this shows only the definition for both DictEntries.key and DictEntries.def but if I use "puts(key);" I see the keyword.
Now, I have an assignment in which I am to accept arguments from the command line and copy them into a cstring and display said cstring unmolested. Then I should store it into another cstring but ignore all punctuation, spaces and capital letters. Like this:
./a5 Marge lets Norah see Sharon's telegram As is: Marge lets Norah see Sharon's telegram ---->: margeletsnorahseesharonstelegram <----: margeletsnorahseesharonstelegram Sequence entered is a palindrome =======================================================
Finally I am to chaeck to see if it is a palindrome. Most of it works and if no spaces are entered nor punctuation it works. However, punctuation causes it to malfunction.
char *FormSeqProc (int argc, char *argv[], char seqAsIs[]) { int len = 0, n = 0; for (int p = 1; p < argc; ++p) { len += strlen(argv[p]);
I have an abstract class Base, with derived classes Derived1, Derived2, etc. I don't know how many there are. So, I have declared an object of Derived like so:
Base* der1 = new Derived1(/* constructor details */);
That gets passed to a function, which modified the data contained by this pointer. However, I need to keep the data from the object, which means that I need to copy the data somehow. The problem is, this copying needs to be done within the function, due to the requirements of the program. I do not know what type the object is, This function will need to reset this data potentially hundreds of times, so I can't just provide lots of objects, as either the function will run out of objects to call or I will run out of space in memory.
How would I create a copy of this, so that I would be modifying a temporary object that could be deleted and I would keep the data that I started with?
I was trying to copy one array to another one of the same size, but when I execute the program all the array values that are supposed to be copied appeared to be 0 when it should be 10, what am I doing wrong?
#include <iostream> #include <cstdlib> using namespace std; int a[10]; int b[10]; void print(int *, int); void zeros (int *, int);
How does one go about copying one binary FILE variable to another in C++? Say I have the following:
FILE* tempFile; //is a binary file and assume already filled with contents FILE* localFile;
tempFile, as the name implies, is stored in a temporary directory (AND has a randomized temp name) within Windows and I want to copy its contents to another file with a predefined name that is within a valid local directory (e.g. C:UsersuserMy Documents est.exe). What do I have to use?
I need a2 to be a deep copy of a1, but if I understand it correctly, then a2 should just be a pointer copy of a1. How do I make a2 be a different instance of B?
I need to open a pdf file (I used system("file_name.pdf"), and it worked). Next is that I want to copy complete content of the file (I want to execute ctrl+a). I want to give this command through my C program, then I will get the content of the windows clipboard having all the copied content.
#include <stdlib.h> #include <stdio.h> int main(){ /* opening a file */ system("results.pdf");
/////////////////////////////////////////////////////// /////copy the content in file (execute ctrl+a)///// ////// ------------------------------------- //// ///////////////////////////////////////////////////////
let's say I have an IntPtr that points to the raw data of System.Drawing.Bitmap. is there any way to create a byte array from that IntPtr without copying the data? I'm a pretty experienced C++ programmer, so I can call ToPointer() on it and convert to a byte* to work with it as a pointer, which is no big deal for me, but using a pointer and doing pointer arithmetic increases the risk of bugs, so I'd prefer not to do it that way if there's another way.