C++ :: Cannot Open A Directory In Terminal
Dec 9, 2013
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.
View 2 Replies
ADVERTISEMENT
Jan 12, 2015
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.
View 1 Replies
View Related
May 12, 2014
I am trying to open a file and print the contents of the file to the terminal window. It works when I put the file right in the directory with the Solution but not if the file is out on my desktop and I use the full path. Here is the code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int OpenFile(){
fstream SampleFile;
[Code] .....
View 5 Replies
View Related
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
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
Jul 2, 2013
I want to hide a terminal appliction or console application without using WinAPI programming or <windows.h> or something like "ShowWindow(hwnd_win,SW_HIDE);
View 19 Replies
View Related
Nov 27, 2014
I've recently refreshed my mac by reinstalling the operating system. Uploaded the previous C and C ++ source scripts I was working with but when I go to compile them through the bash terminal it says command not found? Im not sure whats going because I thought that all the gcc files were already available? What am I messing here.
View 5 Replies
View Related
Feb 17, 2013
I'm generating all ncurses color pairs like this
Code:
void generate_all_color_pairs(){ int foreground;
int background;
int i = 0;
for(foreground=0; foreground<8; foreground++){
for(background=0; background<8; background++){
i++;
[code]....
but according on several sources, some terminals suport more colors.Is there any way to determine how many colors the current terminal supports?
View 3 Replies
View Related
Oct 5, 2014
I am using Xcode to do c++ programming and I have a c++ code, with different input arguments. I want to achieve that in Xcode, I could run multiple simultaneous running of my c++ code. However, the current problem is that once one code finishes, its terminal window automatically closed and I do not have time to look at its result. Thus computer time is wasted. Is there a way to run multiple same c++ code with different arguments input?
View 6 Replies
View Related
Apr 6, 2015
my folder structure looks like this:
Code:
MyProject
| |
header source
| |
Dog.h,Functions.h Functions.cpp, Dog.cpp, main.cpp
How can I compile and run this program (what do I have to type in terminal) - I would like to compile and run it from MyPoject's directory
Code:
cd MyProject
View 14 Replies
View Related
Nov 22, 2013
so i want to make a terminal for my website and BHXSpectre recommended cgi (which i love... c++ web design. just one more reason to not use any other language). anyways, im wondering how would i generate the html for the base of the terminal? ie just the window that i will be writing to
View 2 Replies
View Related
Apr 4, 2014
i am working on class project in which i have to save the tank from canon....imy tank is moving only when i press the moving key.. and after that i see blank screen what should i do to run my process when i am not pressing moving keys....
View 8 Replies
View Related
May 30, 2014
I have study that create a pipe and set a terminal of this pipe like a stdout of a process is a way to implement inter process comunication, but how can i do it in c++?
View 2 Replies
View Related
Jun 29, 2013
I wanted to make the terminal screen bigger in my NCurses program. Let's say if the defaults are 25 LINES and 80 COLS, I want to set them to 40 LINES and 120 COLS.
I've tried resizing all windows, but that did not work, because the actual terminal (console) was not resized. Then I found functions resizeterm and newterm, but they did not work. As far as my understanding goes resizeterm only updates NCurses information with the current configuration, while the window itself is not actually modified.
NCurses man page wrote:The function resizeterm resizes the standard and current windows to the specified dimensions
If I haven't made myself clear ( I sometimes make a mess of things... ), another example would be that I want my program to be fullscreen when I start it. Is this possible? It should be, I found a fullscreen NCurses program once, but the code was too confusing for me to understand.
Having read about things like SIGWINCH, I assume you must define a method for resizing the terminal screen yourself, I don't know where to start?
View 11 Replies
View Related
Feb 4, 2013
Code:
#include <stdio.h>
main() {
int c, n1;
n1 = 0;
while ((c = getchar()) != EOF)
if (c == '')
++n1;
printf("%d", n1);
}
I have a more complicated program I'm wishing to have display the output, however, to save some time I'm using an example of a shorter version. count the lines in input and display the output in terminal when ./program is executed after compilation. To count and compute lines, words and within arrays.
View 4 Replies
View Related
May 11, 2013
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").
View 7 Replies
View Related
Apr 24, 2014
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
View 7 Replies
View Related
Mar 13, 2014
The general design of my app work-flow:
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 :
"tmp" may be a binary file. See it anyway?
View 6 Replies
View Related
Oct 20, 2014
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?
View 5 Replies
View Related
Dec 6, 2013
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.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <unistd.h>
#include <string.h>
#include <sys/stat.h>
[Code] ....
It's crashing around the
Code: while(!feof(in)){ .
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.
View 5 Replies
View Related
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
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
Aug 5, 2013
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() {
DIR* dir;
dirent* pdir;
[Code] .....
View 1 Replies
View Related
Aug 29, 2013
I was working on a program. "hey if this program were to be published it would be bad for people to see all dll files are in the exe directory"....
So I wondered if there is a way to make compiler see a folder in the same directory with exe file which holds all dll files?
Also look at some programs and saw they have a dll folder which holds dll files....
View 1 Replies
View Related
Dec 19, 2014
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.
View 3 Replies
View Related
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