readfile

@readfile in php??

I hate that google can not search for symbols. I saw this in some sample code and wondered why there is an @ sign before the readfile function: @readfile($filename); What does it mean different to without an @ symbol? ...

how to read specific number of floats from file in python?

I am reading a text file from the web. The file starts with some header lines containing the number of data points, followed the actual vertices (3 coordinates each). The file looks like: # comment HEADER TEXT POINTS 6 float 1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 POLYGONS the line starting with the wor...

Editing a remote file on-the-fly with PHP

Hi, I have a requirement to edit a remote text file on-the-fly, the content of which currently stands at ~1Mb. I have tried a couple of approaches and both seem to be clunky or hog memory which I can't rely on. Thinking out logically what I'm trying to achieve is: FTP to a remote server. Download a copy of the file for backup purpos...

How to obtain the first cluster of the directory's data in FAT using C# (or at least C++) and Win32API?

So I have a FAT drive, lets say H: and a directory 'work' (full path 'H:\work'). I need to get the NUMBER of the first cluster of that directory. The number of the first cluster is 2-bytes value, that is stored in the 26th and 27th bytes of the folder enty (wich is 32 bytes). Lets say I am doing it with file, NOT a directory. I can use...

how to back to the first of text file

i have a txt file which have some lines ...and my code is : string line; ifstream myfile("c:\\main.txt"); bool passport = true; while(passport==true){ int pos1=0; cout<<setw(20)<<"PassPort_Number : "; cin>>add.Id ; if (myfile.is_open()) { while(!myfile.eof()){ getline(myfile,line); ...

PHP readfile adds content length to output

I am using the PHP readfile function to read a file and print it like so: print readfile ('anyfile'). This works, but the content length of the file is added at the end of the string also. Why? ...

Output reformatted text within a file included in a JSP

I have a few HTML files that I'd like to include via tags in my webapp. Within some of the files, I have pseudo-dynamic code - specially formatted bits of text that, at runtime, I'd like to be resolved to their respective bits of data in a MySQL table. For instance, the HTML file might include a line that says: Welcome, [username]. ...

NullReferenceExeption when reading from a file

I need to read a file structured like this: 01000 00030 00500 03000 00020 And put it in an array like this: int[,] iMap = new int[iMapHeight, iMapWidth] { {0, 1, 0, 0, 0}, {0, 0, 0, 3, 0}, {0, 0, 5, 0, 0}, {0, 3, 0, 0, 0}, {0, 0, 0, 2, 0}, }; Hopefully you see what I'm trying to do here. I was confused how to do this so I asked her...

Where to put a textfile I want to use in eclipse?

hi there, I need to read a text file when I start my program. I'm using eclipse and started a new java project. In my project folder I got the "src" folder and the standard "JRE System Library" + staedteliste.txt... I just don't know where to put the text file. I literally tried every folder I could think off....I cannot use a "hard cod...

Read data from a text file using Java

I need to read a text file line by line using Java. I use available() method of FileInputStream to check and loop over the file. But while reading, the loop terminates after the line before the last one. i.e., if the file has 10lines, the loop reads only the first 9 lines. Snippet used : while(fis.available() > 0) { char c = (char...

How to let users with required permission download a file via php?

I have a php file that acts as a gatekeeper for all the files I want people to download, who ahve sufficient privilages. The code I use throw the file to the user is header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header("Content-disposition: attachment; filename=\"".$public_filename."\"...

How to read line by line a CR-only file with Perl?

I'm trying to read a file which has only CR as line delimiter. I'm using Mac OS X and Perl v.5.8.8. This script should run on every platform, for every kind of line delimiter (CR, LF, CRLF). My current code is the following : open(FILE, "test.txt"); while($record = <FILE>){ print $record; } close(TEST); This currently print onl...

Php readfile - Force Download

Hi, I am using a flash player to play some mp3 files. At firefox it loads them normally but at IE it doesn't. When i go to the url of the .mp3 file it shows the source code of the mp3 (instead of offering eg to download). So i used a small script to fix it: $url = $_GET['url']; header('Content-type: application/force-download'); header(...

In Java, retrieve a JPEG from a URL and convert it to binary or hexadecimal form suitable for embedding in an RTF document

I'm trying to write a simple RTF document pretty much from scratch in Java, and I'm trying to embed JPEGs in the document. Here's an example of a JPEG (a 2x2-pixel JPEG consisting of three white pixels and a black pixel in the upper left, if you're curious) embedded in an RTF document (generated by WordPad, which converted the JPEG to WM...

Edit file download info PHP/JS

Hey, I'm trying to change the name of a file being downloaded through my site off an external server. Currently whenever I modify the header information, it just takes a reallllllyyyyyy long time for the download to start, so is there any way to do it without changing the headers? Or if not any reason why it would be taking forever to l...

How do I load a file that I bundled with the install of my C# program?

I need to do something like this: StreamReader reader = new System.IO.StreamReader(@"C:\Program Files\The Awesome Program That I Made\awesomeloadablefile.ldf"); Except I don't know where the user has installed the program. How is my program supposed to know where the installed files are? I am a noob, in case you hadn't noticed....

Read Anonymous Pipes More than Once while Keeping Connection Open (WinAPI)

So I keep bouncing between named and anonymous pipes and here is my issue. I tried named pipes and they just didn't seem to work properly for what I wanted, so I'm back to anonymous pipes. However, the anonymous pipe needs to read input from a pipe (to a program that I did not create) and continuously read it as more information is avail...

Reading from a File in current User appdata folder for C#

I'm trying to read from a file inside a the current users appdata folder in C# but i'm still learning so I have this int counter = 0; string line; // Read the file and display it line by line. System.IO.StreamReader file = new System.IO.StreamReader("c:\\test.txt"); while ((line = fil...

*.wav files do not function properly in php

When attempting to view a *.wav URL on our webserver, the data doesn't transfer properly. We are using apache2 with php5.10. Among the apache rewrite rules is: RewriteRule ^(.+)\.(wav)$ /wav.php?wav=$1.$2 [L,NC] And the relevant code from wav.php is: <?php $image = getPassed("wav"); header( 'Content-Type: audio/wav'); set_include_pa...

Number of bytes read by synchronous ReadFile.

Assume I have 1Mb file, file pointer is at the beginning of the file. I call synchronous ReadFile: ReadFile(Handle, Buffer, 1024, Result, nil); the call is succesful, no error occured. Is it possible that Result value (number of bytes read) is less than 1024 (number of bytes to read)? I think that is impossible for disk files, I am n...