directory « directory « C File Q&A

Home
C File Q&A
1.array
2.binary
3.delete
4.Development
5.directory
6.fgets
7.fopen
8.fprintf
9.fscanf
10.fwrite
11.header
12.include
13.input
14.LINE
15.linux
16.open
17.output
18.pointer
19.read
20.size
21.string
22.struct
23.Text
24.windows
25.write
C File Q&A » directory » directory 

1. How to create directories using the C standard library (or otherwise)?    stackoverflow.com

Help appreciated. Couldn't find any mention of this in "the book" (k&r).

2. ctags problem when generating tags for .h and .c file in two different directory    stackoverflow.com

Now I have two directory, all of header files *.h are included in directory /inc, while all of c file *.c are stored in /src directory. The directory just like this, (/project ...

3. glist.c: No such file or directory    stackoverflow.com

I have c/gtk+ application and GList which filled three elements, when i try to run following code with gdb:

if (g_list_length(mw->img_list) > 0)
   printf(">0");
else
   printf("<0");
i see: Program received ...

4. Accessing Directories in C    stackoverflow.com

The program is to open a directory and to display the name of the files... i.e if there is a file..it should say FILE....else DIRECTORY.. but the program displays all the files ...

5. how to load files from any directory in c programme    stackoverflow.com

i want to change this code below for the inwashfile to be able to load from any directory instead of loading from the tech_projects environmental variable.

  /**Get projects directory from ...

6. Regarding checking for file or directory    stackoverflow.com

I have a very simple program here, but it seems to be returning a "true" value to the query S_ISDIR() even when the directory entry is not a directory. Can any one pleeas ...

7. Is it possible to download files to a specified directory?    stackoverflow.com

I'm trying to create a downloader/update tool for my C application. My updater PDL:

  1. Download update.xml from webserver
  2. Check update version by using fscanf and storing floating point to a variable
  3. Check variable with an ...

8. How to loop through all the files in a directory in c # .net?    stackoverflow.com

I want to get the files in folder and also in its subfolders.The following code does not get the files in its subfolder:

string[] files = Directory.GetFiles(txtFolderPath.Text, "*ProfileHandler.cs");
Can anyone Please tell me ...

9. Checking if a file is a directory or just a file    stackoverflow.com

I'm writing a program to check if something is a file or is a directory. Is there a better way to do it than this?

#include <stdio.h>

#include <sys/types.h>
#include <dirent.h>
#include <errno.h>

int isFile(const char* ...

10. Parent directory of a file    stackoverflow.com

Is there any way to find out the parent directory of a file using C program. I would like to give same permissions for the file that the directory has. So ...

11. libclang: error: clang-c/Index.h: No such file or directory    stackoverflow.com

i was trying to use clang to parse c++ code, but am unable to compile my source code because i am unable to find libclang headers. I am running ubuntu 10.04 and ...

12. Keeping Visual Studio project files in sync with directory contents?    stackoverflow.com

We have a large C project with development happening on Linux, Mac OS and Windows. Most of our Windows developers use MSVC -- for example, the free edition of Visual ...

13. c: return all the filenames in directory    stackoverflow.com

How to writte a function that is to return all the file names in a directory including files in the sub directories. So far, I have something like this, but it doesn't ...

15. Creating directory and writing files in that directory ?    bytes.com

whenever, i try to open a file for writing using fopen("xyz.txt", "w"), i am able to create the file only in default C:\ drive. i want to create a directory in the process of running the c code and want to create the file in that directory. So, i would like to know: 1.) How to create a directory in c ...

16. allocator: No such file or directory    bytes.com

* Tong * Hi, I'm following the example in "C++ Templates: The Complete Guide", section 5.4 Template Template Parameters. It's basics/stack8.hpp example has a statement of "#include ", but I got an error for it. $ cat -n allocator.cc 1 #include 2 3 template< typename ALLOC = std::allocator

17. g++: error trying to exec 'cc1plus': execvp: No such file or directory    bytes.com

I'm on a MacBook running mac osx 10.4.11, I have Xcode, gnu, and I'm using the terminal command: g++ -o helloworld helloworld.c I get the error: g++: error trying to exec 'cc1plus': execvp: No such file or directory What does this error mean? It means that your shell could find the g++ frontend of the GNU compiler but that frontend couldn't ...

21. How to know how many files are into a directory    bytes.com

Hi, I need help. I want to read text files contained into a directory, but my program is unaware of how many files are contained into. In bash there's something similar to (figure out) for i in

23. differentiating between files and directories    bytes.com

Hi, I'm wondering how to check for whether a file exists inside a given directory. I'm currently using an ifstream class to do this by passing the name of the file and checking for a .fail (alternatively, .bad) case, however I have a problem when I pass a directory to the ifstream object since both ifstream.fail() and .bad() return a false ...

24. How do i view files of a directory?    bytes.com

Hello NG, I have written some code which worked fine under c#. But i dont know, how this shoud work in c++. I have tryed much things, but i cant find out how to use DirectoryInfo and FileInfo under c++. Thanks for any hints! Peter Here is the c# code: // --------------------------------------------------------------------- // -- View *.prn Files in Directory // --------------------------------------------------------------------- ...

25. Anyone know how to get the files in one directory?    bytes.com

"zjffdu" wrote: [color=blue] > Anyone know how to get the files in one directory?[/color] Yes, I know a bunch of ways. Since I don't know what operating system(s) you're using, I can't be very specific, but one approach is to use "system", like this (assumes DOS or Windows; alter as necessary for Unix, Linux, OS2, Mac, or whatever): #include ...

26. fatal error: iostream: No such file or directory    cboard.cprogramming.com

Code: #include using namespace std; //Added // #include int main() { int product, quantity; double total = 0.0; // display headers cout << "Enter pairs of item numbers and quantities." << "Enter -1 for the item number to end input.\n"; cin >> product; while ( product != -1 ) { cin >> quantity; switch ( product ) // switch ...

27. File/Directory manipulation    cboard.cprogramming.com

28. File and Directory belp please    cboard.cprogramming.com

Hey everyone, I'm wondering if someone could help me. I want to write a small program that will be able to edit some perl script files. I need to load the text file and scan through it and then resave an edited copy. I can do this. What I need help with is there are many files and directorys containing these ...

29. Directories as regular files    cboard.cprogramming.com

30. No such file or directory, confused??    cboard.cprogramming.com

SOURCE_DIR = $(top_srcdir) SOURCE_INCLUDE_DIR = $(SOURCE_DIR)/../../include SOURCE_COMMON_DIR = $(SOURCE_DIR)/ SOURCE_LDSCRIPT_DIR = $(SOURCE_DIR) BUILD_DIR = $(top_builddir) BUILD_PROM_DIR = $(BUILD_DIR) CC=gcc CFLAGS=-c -Wall LDFLAGS=-M -T $(SOURCE_LDSCRIPT_DIR)/Linker.ld SOURCES= Main.c \ ErrorHandler.c \ ScriptProcess.c \ Queues.c \ Commands.c \ Processes.c \ Utilities.c \ Executive.s \ time.o \ $(SOURCE_COMMON_DIR)/Esr.c \ $(SOURCE_COMMON_DIR)/bitset.s OBJECTS=$(SOURCES:.c=.o) EXECUTABLE=Program1 all: $(SOURCES) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $@ .c.o: $(CC) $(CFLAGS) ...

31. looping through all files in a directory    cboard.cprogramming.com

Hi! I'm trying to loop through a bunch of images for processing in a C program. I'm having trouble finding a tutorial or anything on how to do it. I'm essentially looking for some kind of for/while loop that can open the file, pull some info out of it, close it and then move on to the next one until it ...

32. Writable File shows in directory but can't be accessed    cboard.cprogramming.com

33. Directories and files using dirent.h    cboard.cprogramming.com

int main(int argc, char* argv[]) { DIR *pdir; struct dirent *pent; struct stat statbuf; if(argc>1) { pdir=opendir(argv[1]); } else { pdir=opendir("."); } //chdir(pdir); if (!pdir){ printf ("opendir() failure; terminating\n"); exit(1); } while ((pent=readdir(pdir))!=NULL) { stat(pent->d_name,&statbuf); if(strcmp(".", pent->d_name) == 0 || strcmp("..", pent->d_name) == 0) continue; if(S_ISDIR(statbuf.st_mode)) printf("%s

\n", pent->d_name); if(!(S_ISDIR(statbuf.st_mode))) printf("%s %d\n", pent->d_name, statbuf.st_size); } closedir(pdir); return 0; }

34. error: stdio.h: No such file or directory    cboard.cprogramming.com

35. How to save a file in curent directory?    cboard.cprogramming.com

36. files in directory    cboard.cprogramming.com

37. How do I all files in a directory ?    cboard.cprogramming.com

38. Moving a file to a directory containing spaces    cboard.cprogramming.com

/* declare variables */ char original_file[256]; //char duplicate_file[256] = "\"C:\\Program Files\\File Manager\\"; char duplicate_file[256] = "C:\\Program Files\\File Mananger\\"; FILE *org,*dup; char ch; /* gather the file's name */ printf("Enter the name of the original file: "); scanf("%255s",&original_file); fflush(stdin); if(strlen(original_file) == 0) error_exit("Missing filename"); //strcat(original_file,"\""); //Add a quote at the end of the original file's name. strcat(duplicate_file,original_file); //Combine the destination directory and ...

40. File/directory management    cboard.cprogramming.com

42. Check if file is a directory    cboard.cprogramming.com

43. Moving files from one directory to multiple dirs    cboard.cprogramming.com

I have a project that I need to complete to run unattended on windows computer. I would like to schedule it to run at a set interval or to have it watch a folder for activity and then process the files. I have heard that C is a good programming language to use and am hoping that I can accomplish this ...

44. best way to clear a directory and sub/files    cboard.cprogramming.com

45. directory file openong    cboard.cprogramming.com

#include #include FILE * open_file_in( const char *path, const char *filename, const char *mode ) { char buf[BUFSIZ]; strcpy(buf, path); strcat(buf, filename); return fopen(buf, mode); } int main(void) { FILE *in = open_file_in("C:\\", "test.txt", "r"); char ch; if (!in) { perror(NULL); } while ((ch = getc(in)) != EOF) { putc(ch, stdout); } fclose(in); return 0; }

46. File & Directory Access    cboard.cprogramming.com

Thanks for the link. But, to be honest I don't think I put "it doesn't work" - I just wanted some advice. And as for helpless-ness, I would assume that the solution to 100% of all posts on every forum can be sourced from somewhere else on the internet - but I must be mistaken in assuming that forums were for ...

47. getting files in directory    cboard.cprogramming.com

There is actually an ansi way of doing this. You should look into dirent.h. Try something like this out: (NOTE: much of this was from "The C Programming Language") Code: #include #include #include #include #include #include void dirwalk(char *dir, void (*fcn)(char *)) { char name[1024]; struct dirent *dp; DIR *dfd; if((dfd = opendir(dir)) == NULL) ...

48. Directory and File Stuff    cboard.cprogramming.com

49. Display all the files in a directory and change directory?    forums.devshed.com

hi everyone, How to display the files in a directory? And how to change a name of a file using sprintf? char filename[1000]; sprintf(filename,%s,stringName); // stringName is user inputed name rename(file,filename); Is there any way we can change the directory of filename? normally after change the name it located in the same directory as the file. any idea on how to ...

50. Removing all files in a directory    forums.devshed.com

This is one of those things that are OS-dependent, such that we would need to know what OS you're using in order to answer your question. It was only by chance that you dropped a clue, that directory path, which indicates that this is for either UNIX or Linux. The answer for Windows would have been different. It's been quite a ...

52. Libxml/parser.h: no such file or directory    forums.devshed.com

I looked on http://xmlsoft.org/ for a developer package. I did not find it. (That suggestion about my problem with include mysql.h was exactly correct.) Is it possible that the /usr/lib/libxml2.so.2.6.26 is there to support an application installed on the server but the whole libxml2 package has not been installed on my server? Thanks, John

53. Mysql.h: No such file or directory    forums.devshed.com

Linux server, gcc ver 4.1.2, and MySQL ver 14.12 distrib 5.0.22 When I include in my my_prg.c the line "#include ;" I get the compile error: "mysql.h: No such file or directory". my_prg.c compiles and runs without error if I eliminate the "#include ". As far as I can tell, mysql.h does not exist on the server. It is not in ...

54. Getting the files from a directory    forums.devshed.com

55. File creation directory    forums.devshed.com

Hi all, i was curious to know how would i program a function to create a file into any directory. For example. Most windows dirs begin with c:\ But what if they have a custom dir? Like E:\ or H:\ ? I would just like to know if i can make a function that will add a file in the folder ...

56. How to process files in multiple directories?    forums.devshed.com

Code: Hi, I have such a problem: The file structure is like follows: D1 D2 ...... Dn | | ....... | D11 D12 D13 etc. D21 D22 D23 | | ..... | f11 f12 f13 etc. f21 f22 f23 fn Files are under directories D1, D2, Dn, which are the highest directory name, and D11, D12, etc are sencondary directory name, ...

57. Testing if an argument is a directory or file?    forums.devshed.com

I am programming in C on a Plan9 machine, but I have run into a problem. I was told that there was a system/library call called: Dir *dirtest(), which tests to see if an argument is a directory, but I cannot find any documentation, either in the Plan9 manual pages, or on Google, about any such system/library call. Does anyone here ...

58. ReadDirectoryChangesW, file or directory change?    forums.devshed.com

Hi, first of all, sorry about my poor english. I'm using ReadDirectoryChangesW to find what changes happen inside a directory (and subdirectories). But i could only get a path name and an action (FILE_ACTION_ADDED, FILE_ACTION_REMOVED, etc). How could i find if the change affects a directory or a file? Any simple way to do it? Thanks.

59. Checking If A File Is A File Or Directory    forums.devshed.com

Basicalyl what I am doing is using FindFile() and FindNextFile to enumerate to find media files and directories. I can get the media files using the filename string, but I can't figure out how to check if it is a directory or not. In earlier attemps I used to a file pointer to try to open it for reading, and if ...

60. File and Directory Manipulation    forums.devshed.com

Can anyone point me to reference or even a tutorial on file and directory manipulation in a win32 environment? Presently, I'm using dos system calls to create directories, move files using wild cards, stuff like that. Basically, I want to set up a spool directory and have any files that land in that directory moved to directories I designate based on ...

61. BCB, Load random files from a directory    forums.devshed.com

My compiler is bcb(borland c++ builder). Heres my plan, I'm am trying to load Lua script files, I thought maybe the best way to load the scripts onto memory is a TStringList. I want TStringList to search a certain directory and load all the files with the extension .lua in that directory, But I do not know how. Can anyone out ...

62. merging multiple text files from same directory.    forums.devshed.com

i need some help / correction of the code to enable me to merge multiple text files into a final.txt, and then, delete every files which have been created, except final.txt currently, i have suceed in listing files on a directory. now, it's just the problem of reding the datas from the file, and direct merge it + delete the file. ...

63. Discovering if a file is a directory    forums.devshed.com

mike@nergal ~/projects/misc $ ./a --recurse --root /cygdrive/e/mike/projects/misc dirent 0 = #adaptutil.h# dirent 1 = . . is directory... dirent 2 = .. .. is directory... dirent 3 = Makefile ... dirent 12 = util util is directory... Recursing into /cygdrive/e/mike/projects/misc/util... dirent 0 = . . is directory... dirent 1 = .. .. is directory... dirent 2 = avl.c ... dirent 23 ...

64. Extrackting Files To A Directory    forums.devshed.com

65. Adding files from directory to a listbox    forums.devshed.com

Im trying to add filenames from a directory to an itembox. I modified the code @ URL to look like this: Code: #include "stdafx.h" #include #include #include using namespace std; void listDir(const char * sdir, int count){ string str, strDir, str1; struct _finddata_t c_file; long hFile; // Find first file in current directory str = sdir + (string) ...

66. Get all files in a directory    forums.devshed.com

67. Accessing files in sub directories    forums.devshed.com

Hello I am currently working on a project which scan a file and extracts relevant data from it. I have designed a program which does what I need and it works fine for one file. What I would like to know, is there way that my program can access a file in a particular directory, use it and then move to ...

68. How do i loop through all files in a directory?    forums.devshed.com

How do i loop through files in a directory? Posted on: 07/13/2003 13:48:02 Here are two *examples* (recursive and non-recursive). Alternatively, you may use DirectoryInfo/FileInfo. public static void Perform(String directoryName) { String[] fileNames=Directory.GetFiles(directoryName); for (Int32 i=0;i

70. curses.h: No such file or directory    daniweb.com

71. bios.h: No such file or directory    daniweb.com

/* Compile options needed: none - The following program is a simple example which sends and receives one character to/from COM1: */ #include #include void main(void) { unsigned com1_status; unsigned com1_send; unsigned com1_rec; unsigned com1_init; int result, mask; /* open serial port at 1200 baud, 8 data bits, ** No parity, 1 stop bit */ com1_init = _bios_serialcom(_COM_INIT, 0, ...

72. No such file or directory    daniweb.com

#include #include #include #include void main (int) { int gdriver=DETECT,gmode,errorcode; //Requesting auto-detection. int midx,midy,x; //Initializing graphics and local variables. initgraph(&gdriver,&gmode,"d:\\bc3\\bgi"); //Reading result of initialization. errorcode=graphresult(); if(errorcode!=grOk) //An error occurred. { printf("Graphics error occurred : %s \n",grapherrormsg(errorcode)); printf("Press any key to stop : "); getch(); exit(1); //Terminate the program due to error. } /*Changing the foreground color. Note ...

73. browse files and directories in C    daniweb.com

74. Gewttin File and Directories using interrupts    daniweb.com

Click to Expand / Collapse Quote originally posted by Dave Sinkula ... For starters: are you really programming for DOS? Plain old DOS. Not a Win32 console or anything, but 20-year-old DOS? why ? what's the problem ? DOS is a good starting point as well as win32 . The DOS and the Win32 is different flactforms that support different ...

77. Moving All Files To Another Directory    codeproject.com

78. Moving A File From One Directory    codeproject.com

79. Remove Multiple Files in a Directory    tek-tips.com

Is there a way to delete multiple files in a directory from C? I know there is the "remove" function...but, I think that is only to remove a single file, correct? What I'm looking for is something like "remove(*.dat)". Is that possible? If not, does someone have a simple algorithm that maybe loops though the *.dat files in a directory, and ...

80. Trying to move files to another directory!    tek-tips.com

No.It wouldn't be hard though, especially with no error checking.[code]void cp(char *arg1, char *arg2) {FILE *one,*two;char buf[512]; one = fopen(arg2,"r"); two = fopen(arg1,"a"); while ( (fgets(buf,512,one)) != ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.