filesystems

iPhone - fopen and pathForResource - Permission denied

I've tried to open a file directly like fopen("/test.txt","w+"); it works on the simulator but doesn't work on the iPhone. Then I've tried this: NSString *path = [[NSBundle mainBundle] pathForResource: @"GirlName.txt" ofType:nil]; NSLog(path); fichier = fopen([path cStringUsingEncoding:1],"w+"); if (fichier != NULL) { ... } else {...

How to delete network executable files in use during NAnt Build

Related: How to force delete a file? I have a NAnt script that does a full build and deployment to our Dev environment. Deploying the C#.Net Win exe and its used DLLs involves moving them to a network location, where our testers and other developers run them. <copy todir="${dest.dir}" overwrite="true" failonerror="false" > ...

What is the best way to empty a directory?

Is there a way to delete all files & sub-directories of a specified directory without iterating over them? The non elegant solution: public static void EmptyDirectory(string path) { if (Directory.Exists(path)) { // Delete all files foreach (var file in Directory.GetFiles(path)) { File.Delete(...

Hide a file or directory using the Windows API from C

I want to modify a C program to make some of the files it creates hidden in Windows. What Windows or (even better) POSIX API will set the hidden file attribute? ...

C#: tail like program for text file

Hi, I have a log file that continually logs short lines. I need to develop a service that reacts (or polls, or listens to) to new lines added to that file, a sort of unix' tail program, so that my service is always up to date reguarding the file. I don't think that opening a read stream and keeping it opened is a good idea. Maybe I sho...

Getting new lines from a file with FileSystemWatcher

Hi, I'm watching a file with the following code: [..] FileSystemWatcher watcher = new FileSystemWatcher(); watcher.Path = @"C:\"; watcher.Filter = "t.log"; watcher.Changed += new FileSystemEventHandler(watcher_Changed); watcher.EnableRaisingEvents = true; private static void watc...

Internal and external fragmentation

Can anyone please tell me the difference between internal and external fragmentation while allocation of disk space for files? ...

How does srv.sys decide on raw vs core mode depending on the underlying filesystem?

Hello, We are developing a file system for Windows using IFS Kit. We started to investigate a performance problem which caused our file system I/O to be much slower when shared over the network. After looking at it with FileMon and TCPView from Sysinternals we found out that if a NTFS/FAT was shared, the SMB client and server were trans...

Weird standard for FAT32 >4gb files

I have recently encountered an embedded system with IDE drives that are FAT32 but have >4gb files. It appears to do this by setting the file size in the 32byte directory entry to how many bytes the final cluster uses - instead of being the actual file size. This allows the the files to have arbitrary FAT chains. The downside is the only ...

Setting up Smarty directories and paths

Hey all, Just a general question for those of you working with the Smarty templating engine. How are you setting up your file structure? I'd like to follow an MVC format, but I'm not sure how to include all the CSS, Javascript, etc. with the Smarty controller and templates without including these ridiculous paths. Has anyone worked wi...

What is the best way to get the executing exe's path in .NET?

Hi, From program a.exe located in c:/dir I need to open text file c:/dir/text.txt. I don't know where a.exe could be located, but text.txt will always be in the same path. How to get the name of the currently executing assembly from within to program itself so that i can access the text file? EDIT: what if a.exe is a Windows service? I...

Is there a shortcut to get to the /Resources/ folder in iPhone development?

Is there a shortcut method much like NSHomeDirectory() and NSTemporaryDirectory to get to the resources folder within your project? Is the /resources/ folder the best place to be storing a file? ...

c# Find a file within all possible folders?

I was wondering how I could use c# to find a specific file (example cheese.exe) within all possible directories? And then store the path to the directory it found it in? Any help is wonderful :) ...

Windows Folder Security when sharing through a website

I'm working on an application that serves up files (e-commerce downloadable content.) The content is stored on a windows folder share on the server and the application then provides access to that content when the uses requests it. Essentially there is a DownloadFile.aspx?fileId=XXXX Anyway I'm having issues getting the security right o...

Storing Images : DB or File System -

Hi all, I read some post in this regard but I still don't understand what's the best solution in my case. I'm start writing a new webApp and the backend is going to provide about 1-10 million images. (average size 200-500kB for a single image) My site will provide content and images to 100-1000 users at the same time. I'd like also to...

Base file naming conventions

I have a few web pages that all perform various functions for one main piece of functionality or "tool". Instead of having one massive page where I do the various functions based on a "mode" query parameter (?mode=edit, new, view, etc.) I want to break up the pages so debugging won't be such a nightmare since the code is long and comple...

Can I use a mask to iterate files in a directory with Boost?

I want to iterate over all files in a directory matching something like "somefiles*.txt". Does boost::filesystem have something built in to do that, or do I need a regex or something against each leaf()? ...

How do I get an NSArray of filenames of all files in a given directory in my app?

What I want to do seems simple enough: Get an array of filenames in a given "directory" on my app. But the more I play around with NSFileManager and NSBundle I find myself getting more lost...I just want to get the filenames of the files organized in a specific directory in my iPhone Xcode project...For example: The directory in question...

C#: How would you organize a screen saver in the file system?

I am planning to create a screen saver. Thinking of trying out some WPF as well. Anyways, I am not quite sure how I would organize the screen saver on disk in the file system. I have mainly two related issues that I am very uncertain on how to solve: Normally an application lives, with all its 3rd party assemblies, static resources, im...

How do I detect whether the file system is case-sensitive?

I have a List<String> of file names from a folder and a certain file name as String. I want to detect whether the file name is in the list, but need to respect the underlying file system's property of whether it is case-sensitive. Is there any easy way to do this (other than the "hack" of checking System.getProperty("os.name", "").toLow...