filestream

Test Function in MVC Project

So I want to test one of my Functions in my Web Project, but it's not actually connected to anything in the project yet (someone else is working on that part). The Function takes in an "ID" field, goes off and does some queries and gets some data, performs some calculations on it, and then writes a bunch of lines to a FileStream and retu...

how to detect if tfilestream has been freed?

is there a way to see if an instace of tfile stream is being used? for example if i declare FS of type tfilestream,write buffer to it and finally free the stream using tfilestream.free can i check something like: if tfilestream.NotActive then //code if tfilestream.beingused then //code if tfilestream.free = true then //code a...

io operation using same stream object.

Hello all, I want to perform I/O operation in c++. I want to store a pointer to fstream object and using that same fstream I want to read and write to that file. Is it possible without using two different objects i.e ifstream for reading and ofstream for writing. ...

OutOfMemoryException when send big file 500MB using FileStream ASPNET

I'm using Filestream for read big file (> 500 MB) and I get the OutOfMemoryException. I use Asp.net , .net 3.5, win2003, iis 6.0 I want this in my app: Read DATA from Oracle Uncompress file using FileStream and BZip2 Read file uncompressed and send it to asp.net page for download. When I read file from disk, Fails !!! and get Ou...

FileStream: T-SQL vs Win32

One of our teams is building a database (and application) that will use the FileStream feature of SQL 2008 to store documents. According to the MS best practices for filestream, the Win32 APIs are the preferred way to access FileStream data, vs using T-SQL. However, using the Win32 APIs requires using integrated authentication to con...

how to restore a sql server backup containing filestream data assigning a new folder name for filestream data?

To create a new database and populate it from a backup I typically do: CREATE DATABASE MyDatabase -- I create an empty database -- I retrieve the filepath of mdf and ldf files DECLARE @FileData varchar(1000) DECLARE @FileLog varchar(1000) set @FileData = (select filename from MyDatabase.dbo.sysfiles where fileid = 1) set @FileLog = (s...

Does a Stream from a file contain the source file's attributes?

I'm trying to understand how File attributes such as the Created and Modified dates relate to a System.IO.Stream or System.IO.FileStream to the file. Are these attributes contained in the stream, or is the data part of the file that is read by the Stream separate from the file attributes? ...

How do I truncate a file X bytes from the end?

Lets say there is a file which is 150 bytes long and I want to truncate the last 16 (or any number) of it from the end... Is there any other way to do it than re writing the complete file? UPDATE: The SetLength should do the thing, but unfortunately NotSupportedException is thrown using (FileStream fsFinalWrite = new FileStream(File...

System.IO.FileInfo throwing access is denied exception to a local file

I created a sample Silverlight Web project and I am getting 'Access is denied' when I do this: string fileName = "map.gif"; FileInfo fileInfo = new FileInfo(fileName); How can I give the web project access to this folder/file? I added the image into my project, really drawing a blank here.... ...

Log file behaving oddly

I made some changes to our log file since it was giving errors about being in use. Now it's chopping up the log file or not logging at all and its not usable. This is what the log looks like: vice(IndexInformation indexFileInfo, StringBuilder[] Keys) in D:\WORK\SOURCEVS2005\DLLs\DataLayer\DataLayer\DataHandler\DataHandler.vb:lin...

Reading in a binary file containing an unknown quantity of structures (C#)

Ok, so I currently have a binary file containing an unknown number of structs like this: private struct sTestStruct { public int numberOne; public int numberTwo; public int[] numbers; // This is ALWAYS 128 ints long. public bool trueFalse; } So far, I use the following to read all the structs into a List<>: List<sTest...

C++ cache file mean?

I got the C++ code as follows: string cachefile = filename + ".cache"; ifstream cache(cachefile.c_str(), ios::binary); As I did not find it in a C++ reference, what are these codes doing (like ifstream etc)? And what is the cache file please? Why should it be created? What are the advantages and how to interpret it? Above all, what ...

SQL Server 2008 Filestream Logon Failure: unknown user name or bad password

When using(attempting) the SqlFileStream object, I am receiving an error System.ComponentModel.Win32Exception: Logon failure: unknown user name or bad password I'm a little perplexed by this. I'm using SQL Server authentication in the connection string I can write to the table in question except for the FILESTREAM column The SQLSE...

How to Access File Descriptor of Open File

Is there any way to access the file descriptor of a file opened in c++? So ... #include <iostream> #include <fstream> using namespace std; int main() { ifstream inputFile( "file.txt",ios::in ); cout << inputFile.fileDesc << endl;//made up call return 0; } The question is, does something like fileDesc exist for...

SqlFileStream Write bug?

I've been writing and reading PDF's to a SQL Server 2008 FileStream for a few months now without any major problems (apart from tedious user permissions). Yesterday I had a user inform me that some of their PDF's were being corrupted after being written into the FileStream. So, I did some debugging and I found the problem, but it appears...

ASP.NET MVC 2: "The process cannot access the file <filename> because it is being used by another process."

I'm trying to use Controller.File to return a FilePathResult from a view in my ASP.NET MVC 2 project. I use it like this: return File(pdfFilePath, "application/pdf", "foo.pdf"); However I keep getting this error in the yellow screen of death: The process cannot access the file [the file path] because it is being used by another proce...

Upload a file with encoding using FTP in c#

Hello The following code is good for uploading text files but it fails to upload jpg files: (not completely - the file name is good but the image is corrupted) private void up(string sourceFile, string targetFile) { try { string ftpServerIP = ConfigurationManager.AppSettings["ftpIP"]; string ftpUser...

File.createTempFile create special file or how to force flush data to harddrive?

Hi, I'm using File.createTempFile to create regular files I want to keep, the reason I use this method is because it guarantees a unique file name. However I'm seeing a strange thing with files created by this method: After I flush and closed the output stream on this file, I crash the machine running JVM deliberately, I assumed since t...

SQLFileStream exception "The network path was not found"

I am trying to insert a file into a database which uses SQL File Streaming. When I try to initialize the SqlFileStream object that I will be inserting with I receive a File Exception stating that the network path could not be found. The code in question is below: using (SqlFileStream sqlStream = new SqlFileStream(filePathName.Value, fi...

Is it possible to access the FILESTREAM share?

What I mean is being able to access it through Windows Explorer or other programs. I believe the answer is that it isn't possible. But I really want to know why it's not allowed. It seems that the files could be made available read-only through the network share. ...