fileread

How to take a typename as a parameter in a function? (C++)

I need to be able to pass a typename as a parameter: int X = FileRead(file, 9, char); The concept is for FileRead(std::fstream, int pos, ???) to read pos*sizeof(whatever the type is) to get the desired position. I tried templates: template<typename T> T FileRead(std::fstream file, int pos, T type) { T data; file.read(reinter...

Nsis: Problem in FileRead

When I read a file using FileRead and display the contents in a listbox I get some garbage characters after the line. Eg. if my line is : a.txt I get something lk: a.txt$$ (Note $$ are some garbage characters) Its probably because of $\r$\n. What can I do to correct this? ...

NSIS: Problem to copy 1 file to another excluding a line

I want to replace the file 1.txt with its original contents except the line in R1, for which I wrote the following code: FileOpen $0 "1.txt" "r" GetTempFileName $R0 FileOpen $1 $R0 "w" loop: FileRead $0 $2 IfErrors done ...

Read .inf file in nsis script

How to read a .inf file in nsis script? To be precice: I wanna read ${PRODUCT_VERSION} from a .inf file which is suppose like this: Version = 1.0.0, so I have to read it in .onInit function. Tried using FileRead or ConfigRead but failed to get what is required. I have to read a .inf file only cant change it to .txt or .config or any othe...

how do I open and read a file using ifstream in C++?

I would like to open a file and read a line from it. There will be only one line in the file so I don't really need to worry about looping, although for future reference it would be nice to know how to read multiple lines. int main(int argc, const char* argv[]) { // argv[1] holds the file name from the command prompt int numbe...

PHP fileread plain text files

Hey, I want to 'force' the download of a plain text file in PHP. I have the following code, which I picked up on the web somewhere: if (isset($_REQUEST["file"])) { $file=$_REQUEST["file"]; header("Content-type: application/force-download"); header("Content-Transfer-Encoding: ansi"); header("Content-length: ".filesize($file)); ...

How to stream a media file using PHP ?

I am trying to build an application in which i have to stream the media files (audio and video) to the browser. I am reading the file through php and send the data to browser. I am using the following code. header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the pa...