filestream

FileStream in use

If my file stream is in use (every time I try to debug, it hits that first line and says it's in use), how can I force a release? every time it hits this code, I get a message saying something is using it: FileStream fileStream = File.Open(@"C:\somefile", FileMode.Open, FileAccess.Read); byte[] buffer = new byte[fileStream.Length]; ......

SQL Server 2008: Unable to remove a FileStream File and Filegroup

With SQL Server 2008 SP1, I've removed the only table that had a Filestream associated with it but each time I attempt to do the following: alter database ConsumerMarketingStore remove file CMS_JobInstanceFiles alter database ConsumerMarketingStore remove filegroup JobInstanceFiles I get the following exception: Msg 5042, Level 16, ...

Encrypting filestream data

SQL Server 2008 supports data at rest security through TDE (Transparent data encryption), but the encryption excludes files stored on harddrive through FILESTREAM feature. How have you handled encryption of this data on file system stored through FILESTREAM? Encrypted File System seems to be an option, but would cause problem during DB...

Instead Of Delete Trigger with FileStream

Why can't i use an Instead Of Delete Trigger on a table that has a varbinary filestream column? Is there a workaround for it? I want to update a field when a delete command is performed. Thanks ...

Reusing a filestream

In the past I've always used a FileStream object to write or rewrite an entire file after which I would immediately close the stream. However, now I'm working on a program in which I want to keep a FileStream open in order to allow the user to retain access to the file while they are working in between saves. ( See my previous question)....

How can I read image from Stream with ImageMagick.Net library

I have a stream that has a picture. I need to write this picture to disk with a name in the format: "width x height". The problem that I'm getting the picture dimensions with ImageMagick. but ImageMagick cannot read files from the memory, but only from the disk. Is the only solution is to create a temp file, read it, and write another ...

PHP Streaming MP3

I have a very similar situation to the person who asked: http://stackoverflow.com/questions/1516661/can-i-serve-mp3-files-with-php Basically I am trying to protect mp3 files from direct download, so users have to go through php to get authenticated first. Here's my code: header('Content-type: audio/mpeg'); header('Content-length: ' . fi...

How to create a new file from a FileStream?

I have a javascript file as an embedded resource in an assembly, and I'm trying to use the Stream from "System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("someName");" to create a new FileInfo object. My confusion is how to use a stream to create the FileInfo. If anyone can help me in this I would be greatly app...

SQL Server 2008 FILESTREAM Feature with VLDB

I have a bunch of xml files that is about 700 GB in size. I'm going to load the data within those files into a SQL Server 2008 database table(tabular data). In addition to the fields that will hold the data in a tabular format, the table will contain a field of SQL Server XML type that holds the xml data as a whole. I want to use the FIL...

FileStream: used by another process error

I have two different modules that need access to a single file (One will have ReadWrite Access - Other only Read). The file is opened using the following code in one of the modules: FileStream fs1 = new FileStream(@"D:\post.xml", FileMode.Open, FileAccess.ReadWrite, FileShare.Read); Th problem is that the second module fails while try...

How to append text to a text file in C++?

How to append text to a text file in C++? Create new if does not exist and append if exist. ...

Silverlight 4.0 FileStream

FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read); Arguments: << path >> Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&amp;Version=4.0.41108.0&amp;File=mscorlib....

splitting a stream

how to split a stream in to requires size, i need to send it in a sockets to another system,then i need to append them and create a FILE ...

c++ library for endian-aware reading of raw file stream metadata?

I've got raw data streams from image files, like: vector<char> rawData(fileSize); ifstream inFile("image.jpg"); inFile.read(&rawData[0]); I want to parse the headers of different image formats for height and width. Is there a portable library that can can read ints, longs, shorts, etc. from the buffer/stream, converting for endianess ...

StreamWriter not creating new file

I'm trying to create a new log file every hour with the following code running on a server. The first log file of the day is being created and written to fine, but no further log files that day get created. Any ideas what might be going wrong? No exceptions are thrown either. private void LogMessage(Message msg) { string name = _log...

StreamWriter stops writing when file is opened from web link

Following on from my previous question... The following code creates log files on a web server: private void LogMessage(Message msg) { using (StreamWriter sw = File.AppendText(_logDirectory + DateTime.Now.ToString("yyyyMMddHH") + ".txt")) { sw.WriteLine(msg.ToString()); } } The log files are linked to from an admi...

How to read Hebrew text using System.IO.FileStream?

Hi all Am I missing something or does System.IO.FileStream not read Unicode text files containing Hebrew? public TextReader CSVReader(Stream s, Encoding enc) { this.stream = s; if (!s.CanRead) { throw new CSVReaderException("Could not read the given CSV stream!"); } reader ...

SQL Server 2008: FileStream Insertion Failure w/ .NET 3.5SP1

I've configured a db w/ a FileStream group and have a table w/ File type on it. When attempting to insert a streamed file and after I create the table row, my query to read the filepath out and the buffer returns a null file path. I can't seem to figure out why though. Here is the table creation script: /****** Object: Table [dbo...

Extracting, then passing raw data into another class - How to avoid copying twice while maintaining encapsulation?

Consider a class Book with a stl container of class Page. each Page holds a screenshot, like page10.jpg in raw vector<char> form. A Book is opened with a path to a zip, rar, or directory containing these screenshots, and uses respective methods of extracting the raw data, like ifstream inFile.read(buffer, size);, or unzReadCurrentFile(z...

django return file over HttpResonse - file is not served correctly

I want to return some files in a HttpResponse and I'm using the following function. The file that is returned always has a filesize of 1kb and I do not know why. I can open the file, but it seems that it is not served correctly. Thus I wanted to know how one can return files with django/python over a HttpResponse. @login_required def se...