C++ :: Thread Library - No Such File Or Directory

Jul 25, 2014

When I write a code in c++ includes thread library it says "thread:no such file or directory". How can ı use thread library .

I think I should download boost or c++11 but I couldn't do it .

View 4 Replies


ADVERTISEMENT

C/C++ :: Open Directory And For Each File In It Create A Thread

Dec 20, 2014

I'm trying to write a program that opens a directory and for each file in directory,it creates a thread. Inside of the thread,it reads the numbers in file.(one number in one line)And then calculates the average of these numbers. I write something like this;

void *calculate(FILE *piece){
int a,k=0,s=0,ort;
while(!feof(ayri)) {
a=fgetc(ayri);
s=s+a;

[Code] ....

When I run the programme,i get lots of errors like 'segmentation error' and some stuff about pthread_create. And I don't think the 'calculate' function is right.I don't know the right way to read numbers line by line.

View 3 Replies View Related

C# :: One Thread Trying To Pass Data To Another Thread Using Serial Port

Jul 30, 2014

I have a class which I wrote and one of its object is "SerialPort" .NET class. In my MainWindow I created instance of my class called "SerialPortComm", then I send through some functions of mine, commands to the Serial Port, and I receive answers through "DataReceived" event.

But when I trying to use Dispatcher.BeginInvoke to write my data I have received (successfully), nothing shows on the RichTextBox which I'm trying to write to.

What can caused that, and How I can make it works?

SerialPortComm.cs

public partial class SerialPortComm : UserControl {
public SerialPort mySerialPort = new SerialPort();
public void Open_Port(string comNumber, int baudRate) {
mySerialPort.PortName = comNumber;
mySerialPort.BaudRate = baudRate;

[Code] ....

View 7 Replies View Related

C++ :: How To Save File Directory To Text File Using Ofstream

Jul 22, 2013

I'm having a little problem with std:fstream - in my program, the user selects the location of a file which I want to remember. So, I have something like this:

Code: std::string fileLocation;
//Code here creates an 'open file' dialog box which lets the user choose which file to open.
//The string 'fileLocation' now contains the path to the chosen file.
std::ofstream prefs("prefs.txt");
if (prefs.is_open())
{
prefs << fileLocation;
prefs.close();
}

This works fine if the file chosen is in the same directory as the program, however, if they try to choose a directory outside of where the program is kept, it saves the text file into that directory instead of the same one as the program. So, it looks like outputting a directory into an ofstream actually changes the location to which the file is saved.

Is there a way to save the file directory to a text file using ofstream and still have the text file save in the same directory as the program?

View 5 Replies View Related

C++ :: Merge Sort Between 2 File With Thread

May 29, 2014

// mergefile2norecreation.cpp : definisce il punto di ingresso dell'applicazione console.
//
// Filemerge.cpp : definisce il punto di ingresso dell'applicazione console.
//

#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[]) {

TCHAR inputfile1[MAX_PATH];
TCHAR inputfile2[MAX_PATH];
TCHAR outputfile[MAX_PATH];

[Code] .....

There is a smart way to make a merge sort between 2 file already ordered? I had try it ,and above there is my result,it works but i think that it's possible to do it in a smart way...

View 4 Replies View Related

C :: Using Process ID As The Name Of File Directory

Jan 31, 2015

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);

[Code]...

View 13 Replies View Related

C++ :: Opening A File Within A Directory

Apr 26, 2013

I have problems opening a file within a directory.

#include <dirent.h>
#include <string>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

[Code] .....

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

View 6 Replies View Related

C/C++ :: Get File List From Directory By Name

Nov 19, 2012

I try to get file names listed by date or name in c. How can i do this.

There is a code: But this gives randomly file names.

DIR *dir;
struct dirent *ent;
    dir = opendir ("c:src");
if (dir != NULL) {  
  /* print all the files and directories within directory */
 
[Code] ....

View 2 Replies View Related

C++ :: Header File - Running Class Function As A Thread

Apr 20, 2014

I have a header file with a bunch of functions. I want to create a thread using the <threads> package and am using

void myclass::functionX() {
}
void myclass::function() {
std::thread tr(myclass::functionX);
}

I am getting the error "no instance of std::thread::thread matches the argument list argument types are (void());

View 1 Replies View Related

C :: GCC Does Not Recognize Lib Location - No Such File Or Directory

Aug 19, 2013

I have my libraries in ../../lib location

and when i try to compile :

gcc -O9 -I ../../include/ -L ../../lib/ -o test test.c thr.o -lm -lthread

I get :

gcc: error: thr.o: No such file or directory

obviously the problem is the library path location but my obj is there

ls -al ../../lib/ | grep thr.o
-rw-rw-r-- 1 xxxxxx xxxxxx 23544 Aug 12 23:03 thr.o

????

View 2 Replies View Related

C++ :: Trying To Substitute A Variable For File Directory

Jul 1, 2014

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&)'

#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <stdio.h>
#include <windows.h>
using namespace std;

[code]....

View 2 Replies View Related

C++ ::  Read Only The Oldest File From Directory

Jan 5, 2013

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?

View 3 Replies View Related

C++ :: Input File Directory From The Console?

Aug 19, 2014

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.

View 2 Replies View Related

C++ :: Header File - Compiler Error Before Directory

May 18, 2014

I'm trying to compile this code which is a header file.

#ifndef CUBEMAP_H_INCLUDED
#define CUBEMAP_H_INCLUDED
#include "Texture.h"
#include <string>
class CubeMap : Texture {

[Code] ....

But I get the following error:

|9|error: expected ')' before 'Directory'|

How can i resolve this?

View 6 Replies View Related

C/C++ :: Fatal Error - Iostream / No Such File Or Directory

Aug 4, 2014

I keep running into this error, even though the first few times i built and ran something it worked perfectly, and since I'm new to CodeBlocks (or any IDE/Compiler for that matter) what to do.Any code i put in, it'll give me this error....

View 3 Replies View Related

Visual C++ :: Initializer List - No Such File Or Directory

Oct 21, 2013

I have a project that compiles fine with VS 2010. As I compile it with VS 2012 it generates the entitled error. Why?

View 5 Replies View Related

C :: Open New Text File With First Letter Of Line On A Certain Directory

May 23, 2013

I'm reading from stdin a line. With that line, I should open a new textfile with the first letter of that line on a certain directory. My code is the following :

Code:

int main() {
char line[BUFSIZ];
FILE *ptr_file;
int x;
while(fgets(line,BUFSIZ,stdin) != NULL){

[Code] ....

char caminho[] is the directory in which I want to create the text file and chave will be the first letter of the line in stdin.

How am I supposed to use strcat to get these two together in a string to then use ptr_file =fopen(caminho, "w");

View 3 Replies View Related

C :: Make A File In Directory That Cannot Be Deleted By User Out Of Program

Jul 4, 2013

I have two questions about C programming here :

1. I want to make a file in the program directory that can't be deleted by user out of the program make that file.for example if I make a file named "123.xyz" by the program named "text.exe" and then exit test.exe ,if I tried to delete the file 123.xyz I faced the error and I could not do it but by the test.exe program that make that file.

2. I heard about a function called "Parbegin()".any way i want to know is there any possible way to run two or more functions of a file.c together,like the parbegin function did an do in OS?

View 2 Replies View Related

C++ :: Allow User To Select Arbitrary File From Working Directory?

Apr 28, 2014

I know how to open a specific files by using

ifstream infile("something.txt");

but how do you let the user select an arbitrary file from the working directory?

View 12 Replies View Related

C# :: Writing To Text File And Uploading It To Server Directory

Dec 25, 2014

I want to write a single line to a file and upload it as a .txt file to a server directory . I know the traditional way to upload a local file to a server

public bool ftpTransfer(string fileName){
try {
string ftpAddress = "test.com";
string username = "test";
string password = "test";

[Code] ....

is there anyway to change this so that I can write the contents of the file through the program and upload it directly without having a local file?

View 8 Replies View Related

C Sharp :: Regex Pattern That Takes Only Directory Without File Name

Dec 5, 2014

regex pattern that takes only directory without file name
private void txtDownloadRoot_Validating(object sender, CancelEventArgs e)
{
Regex driveCheck = new Regex(@"([a-zA-Z]:[^/:*;/:?<>|]+)|({2}[^/:*;/:?<>|]+)");
if (!driveCheck.IsMatch(txtDownloadRoot.Text))

[Code].....

View 1 Replies View Related

C++ :: Checking Existence Of A File In A Directory Using Stat Command

Nov 5, 2014

I am using stat command to check the existence of a file in a directory.

The directory is having some 10K files. I feel the stat() call is expensive as i do not need the structure to be populated.

I want only the existence of the file.

Is there any other alternative faster way to do this in C.

View 14 Replies View Related

C :: Program That Acts As File Manager For All Files And Folders In Directory

Jul 29, 2013

I need to write a program that acts as a file manager for all the files and folders in the directory given as an argv parameter and all of its subdirectories. This means be able to move, rename, delete the files in the sub directories. Also I need to be able to store the structure of folders and files in a binary tree adt (I have one already). But I'm not sure what libraries to use with this and how do I open a directory is it like a file with fopen?

View 4 Replies View Related

C Sharp :: Copying A File From Current Directory To System Drive

Feb 8, 2014

I have tried to use File.Copy and File.Move but non of them would work as I expected .....

View 1 Replies View Related

C/C++ :: What Library To Use To Read BMP File

Jul 25, 2014

I need to write a program that will read a .bmp image file of an 8 by 8 pixels resolution and write the data about every pixel in a text file. The problem is, that I can't find a library to use. I've tried using CImg but even the basic test examples fail with "undefined reference to setdibbitstodevice...." or something like that. I know CImg is a powerful library and it can even manipulate images, but I need something just to read it.

View 2 Replies View Related

C++ :: Linking Static Library To CPP File

Jun 20, 2013

I have a libcx3d.a which contains my VrmlParser class and other classes which are used by VrmlParser. I have a main.cpp which does this :

VrmlParser vp = new VrmlParser();
double **VOB = vp.getVOB();

When I compile using g++ main.cpp -o main -L. -lcx3d, I get the following errors :

'VrmlParser' was not declared in this scope.
expected ';' before vp.
'vp' was not declared in this scope.

There is a header file called "VrmlParser.h" in the static library. Should I include this header file in main.cpp ? If so, will include "VrmlParser.h" work ? I have the .a and .cpp in the same directory. I can't find the header file for the static library.

View 9 Replies View Related







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