C/C++ :: Create Directories From String?
Sep 30, 2014
So first, I'm sending files from a server to a client. Basically, the server says "Incoming file" and tells the client "The name of the file is: ". So taking the name, I need to create folders, if they don't exist, for the received file to be placed in (since std::ofstream doesn't allow creating directories).
My current code below is working. My trouble is listed below the code.
std::stringstream ss (name);
//name is the recv'd name
std::string token;
[Code].....
View 1 Replies
ADVERTISEMENT
Jul 21, 2013
The code below is suppose to create directories and upload files, but it is not working. What can I do to make the code work?
Code:
void CRECURSIONDlg::Recursion(CString sPath) {
hInternet = InternetOpen(TEXT("BEAR FTP"),
INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
// Make sure there are no errors
hIConnect = InternetConnect(hInternet,"192.168.1.4", 211,
"******", "*****", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
[Code] ....
View 6 Replies
View Related
Mar 6, 2015
I'm stuck on unix system programming and am beginner about it. Assume that there is a directory which X. There are a file(text1.txt) and another directory which is Y in X. Last, there are two files(text2.noExtension) and text3.noExtension) and another directory which is Z in Y. My goal is that read files and enter directories until there is no directory. How to go on. Example:
Code:
#include <stdio.h>
#include <dirent.h>
int main (int c, char *v[]) {
struct dirent *pDirent;
DIR *pDir;
if (c < 2) {
printf ("Usage: testprog <dirname>");
return 1;
[Code]...
View 6 Replies
View Related
Oct 5, 2013
[URL] ....
I've been getting these errors on two computers through four different compilers. It seems the directories arnt set up. If that's the cause, I have no clue how to resolve that.
Its a very simple prog too; it just calculates a dist, using dist formula.
#include <cstdlib>
#include <iostream>
#include <math.h>
using namespace std;
void calcDistance (int x1, int y1, int x2, int y2);
[Code] ....
View 6 Replies
View Related
Apr 3, 2014
I have a program where I want to export the .lib file in a "Lib" folder, and the .dll file in the "bin" folder. How can I choose where the lib file and .dll file go?
View 3 Replies
View Related
Apr 12, 2014
I'm using the code found on the site here:
//* remove example: remove myfile.txt */
#include <stdio.h>
int main () {
if( remove( "myfile.txt" ) != 0 )
perror( "Error deleting file" );
[Code] ....
I replaced the myfile.txt with the directory of the file I want deleted.
"C:SOUNDSsavegame.dat"
It returns: Error deleting file. No such file or directory exists.
I've triple checked the directory. Its correct. I must be using this incorrectly. How?
View 5 Replies
View Related
Oct 23, 2013
I have these two files:
/project/protocol/guarddog/report.h
/project/protocol/sky/report.h
I have two report.h files located in two different directories. However the contents of them are different. How can I include the report.h file located in guarddog into the report.h file located in sky?
I assume just doing this would be ambiguous:
#include "report.h"
View 1 Replies
View Related
Dec 28, 2014
Using CodeBlocks. I've added the path to the library files in 'search directories' in 'linker' tab.
E:DataCompLibrarySDL2-2.0.3libx86
I also added the include files location in 'search directories' and that works fine.
But still when I add 'SDL2.lib' in linker settings and try to compile I get: cannot find -lSDL2.lib
View 3 Replies
View Related
Nov 19, 2012
For each project in a VS solution it's possible to stipulate per-project folders that get searched in addition to the folders that you've set globally for Visual Studio.
Which folders take priority? Do the project's folders get searched first? Or do the global folder get searched first? Or is it possible to select one set as having priority over the other?
(this is VS 2005 BTW)
View 4 Replies
View Related
Jun 4, 2012
I am currently working on a program that will take an image and compare it with all other images in the current directory and sub-directories. I decided to use Qt for this as Qt has a QImage class with an overloaded == operator. This seems to work well if there are duplicates of the same size.
However, my goal is to not only find duplicate images of the same size, but the same image which may be a different size. To do this, I shrink the larger image to the size of the smaller image using the QImage scaled function.
The concern I have with this is that the scaling isn't done the same way the smaller image may have been scaled. I tested this by shrinking a copy of a picture in Paint, that image does not get deleted. I believe that == is looking for an identical image, so when I do the shrinking (via that scaled function), even if it is of the same picture I shrunk in Paint, the two methods of shrinking are not identical, and so the images appear different.
Any better method I can try? Something that can allow for slight deviations, such as an image being 99% "the same" as another. (I admit here that I will need to define some metric for what "the same" means.) In this case, the method assumes they are "identical" and gets rid of one of them.
The main way I can think of doing this is to go through each image, one pixel at a time. If the two pixels from the different images at the same index are the same, then I can increment a same pixel counter. If this number is 99% (or some other threshold) of the total pixel count, I can make the assumption the images are the same.
View 6 Replies
View Related
Oct 17, 2014
I am having trouble with string statements in general. But the biggest problem I have is that my assignment requires that I make a grocery list with a function that uses string statements. I have all the variables and functions other than the string working. But i need a basic outline on the receipt. NO specifics! I just need a basic outline more than our teacher has given us. Also I have searched for other programs using receipts but they used vectors and my class is not into that yet how vectors work yet so I am avoiding using them.
View 5 Replies
View Related
Dec 7, 2013
I can not cope with the task.Create a function that will take a string of characters (including spaces) and print the numbers of characters (including commas, periods, etc.) in it. The output will be arranged alphabetically. Distinguish case sensitive!
View 6 Replies
View Related
Dec 24, 2014
I wanted to create a new class object and I want to name it from a string. Something like this:
string name = "Mike";
Customers name;
//to create a new object in customer class using the name string
Is there any way to do this?
View 11 Replies
View Related
Nov 10, 2014
I'm VERY new in programming and I'm having trouble converting an integer to string. I need to create a function for a programme I'm working on for my school. My problem is that i am only allowed to use the libraries stdio.h, time.h and stdlib.h as well as printf, scanf, system, srand, time and rand. If I was allowed to use itoa or pointers it would be easier but i am not.
View 4 Replies
View Related
Mar 28, 2014
I would like to have a program with a 5 mb string embedded in it kind of like this:
Code:
const char *c;
c = (const char*)"BEGIN_STRING_HERE, (5 MB of arbitrary values here)";
Is it possible to generate this string at compile time? Maybe with a macro? I'm trying to avoid a source file with a 5 mb string in it.
View 3 Replies
View Related
Sep 14, 2014
Is it possible to create a dynamic char array on the fly directly from stdin? I do not want to create a fixed length array before hand and then copy contents of it into a malloc created array.
Code: //[1]
char line[MAX1];
gets(line);
[Code]....
I could do either [1](buffer overflow problem) or [2] and then goto [3]. But both will have a problem if the input is more than the size MAX1(use defined).
Is it possible to do something of the effect of readLine() method of BufferedReader class in Java or the Console.readLine in .NET? Is it possible to peek into stdin and see the size of the input and then creat an array of the same exact size?
View 8 Replies
View Related
Jul 25, 2013
I need a code in c++ . It should count the Files and Directories in root folder with every folder information i need the below information
1) no of files and folder
2) how many files are there in each folder
3) with size of every folder and files it contains
I am new in c++ ....
View 1 Replies
View Related
Oct 26, 2013
I have a struct called Array and I'm to create a function to create a dynamic array that's fill with randomly generated integers from 0 to 50 (inclusive) and a function to destroy the array for freeing its memory. Below the code that I have written so far.
Code:
* Struct */
typedef struct {int *pArray; //the dynamic array
int length; //the size of the dynamic array}Array;
/* Function to create a dynamic array */
Array *initializeArray (int length) {int i;
}
[code]....
View 7 Replies
View Related
Apr 10, 2014
I need to create a project that create a automated backup of a file.
i will get the file from C:/Folder/file.exe and move for a other created folder, but.. in every time that user make this backup, a folder will be created with year, month and date, like: C/Folder2/2014/April/16:42/file.exe.
View 4 Replies
View Related
Feb 10, 2013
For my data-structures class, I am attempting to create a binary search tree template to be used to create an AVL tree. I've written a Generic_Tree template for the BST to inherit from, and before I jump into implementing the AVL tree I'm testing the BST member functions. Everything was compiling fine until I added the BST insert() function. Now, I'm getting the following error message from my linker:
undefined reference to 'BST<void>::insert(int, void*)'
Stemming from the call in main line 16.
my makefile compiles with:
g++ -Wall -g Generic_Tree.cpp BST.cpp barfing.cpp main.cpp
Generic_Tree:
template < typename NODE_DATA, unsigned MAX_KIDS >
class Tree {
protected:
struct NODE {
NODE_DATA* contents;
Tree* child[MAX_KIDS];
Tree* parent;
[Code] ....
I'm use to c and havn't used classes or templates before (except for declaring instances of them). The whole syntax is mystifying to me,.
View 4 Replies
View Related
Feb 25, 2013
What is the efficiency of the two assignments (line 1 and 2), i.e. (function calls, number of copies made, etc), also the Big O notation. I know there are function calls for retrieving the size of each string in order to produce a new buffer for the concatenated string...any difference between line 1 and 2 in terms of efficiency?
String s("Hello");
String t("There");
1. s = s + t;
2. s += t;
View 3 Replies
View Related
Mar 26, 2014
Ok, so I'm writing this code and when I build it keeps saying cannot implicitely convert type int to string even though I declared my variables as string. Why is it giving me this error?
private static string Repair()
{
string result="";
string beep;
string spin;
Console.WriteLine("Does your computer beep on startup?:(y,n)");
[Code]...
View 3 Replies
View Related
Jan 29, 2014
I would like to understand a function on strings. Below is a code that I took from my teacher where the user inputs a string and prints out the length of the string.
Code:
#include <stdio.h>
#include <string.h>
int main() {
char str[100];
int i = 0;
[Code] ....
Now I understand that it returns the count in "int" so my question is:
Let's say i declared
Code: int count = 0;
at the beginning of the code and then made
Code: count = strlen(str);
why wouldn't i have the same result? Is there a way to do it also?
View 7 Replies
View Related
Nov 15, 2013
I have this string d ="3 J JD, K" and i want to split the string to individual string. I have this code which eliminates the comma but doesn't split the string into individual string.
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main() {
string str = "3 J JD,K";
stringstream ss(str);
[Code] ....
Output of the code is
3 J JD
k
but I want
3
J
JD
K
Also after I split the string is there any way to put the split string into individual string variables.
View 9 Replies
View Related
Oct 19, 2014
Very new to programming, and I know that there must be another way on inputting a string into each array cells not by just inputting it one by one, but as a whole. My code at the meantime is: [URL]
View 1 Replies
View Related
Jul 14, 2014
I have problem with string compare. I want to compare the string user input with a string in binary. And I don't know how to do it. Problem in function login();Here is the code: And you also can download file in attachment too..
Code:
#include<conio.h>#include<dos.h>
#include<stdio.h>
#include<process.h>
#include<string.h>
char nsb=1;
char ch, password[20], passlogin[20], inputpass[20], checked[20];
FILE *fp;
}
[code]....
View 1 Replies
View Related