readfile

Direct Disk Access: WinAPI WriteFile seems to fail on partitions larger than 2147483647 (7FFF FFFF) sectors

与世无争的帅哥 提交于 2019-12-23 05:29:36
问题 I wrote a small program in VB .Net to physically sort folder entries on FAT partitions (see http://www.public.bplaced.net). To do this, I use API calls to Kernel32.dll. I open the partition with CreateFileA, use the handle to lock the drive with DeviceIoControl FSCTL_LOCK_VOLUME and then read and write sectors directly with SetFilePointer / ReadFile / WriteFile (synchronous, with NO_BUFFERING). All works PERFECTLY, except when I use my program with partitions larger than 2147483647 sectors

Where to save text file to be able to read it into Android project

↘锁芯ラ 提交于 2019-12-23 04:12:49
问题 I have looked around to find out where to save general text files for reading into my Android project, but couldn't find a definite answer. When I save my "foo.txt" file into my res/raw folder as someone suggested (I had to create the raw folder) the R.java file gets error for these lines: public static final class raw { public static final int 1_1=0x7f050000; } This is because my file contains the string "1_1" on the first line, which I want it to have. Where in the folder structure should I

Error with ReadFile and Overlapped

拥有回忆 提交于 2019-12-23 02:52:07
问题 I have a problem with ReadFile and overlapped. first I use ReadFile with overlapped with 0 ZeroMemory(&overlapped ,sizeof(OVERLAPPED)); hDevice = CreateFileW(zwpath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL); if(hDevice != INVALID_HANDLE_VALUE){ ret = ReadFile(hDevice, buff, 1024, &numerobyte, &overlapped); } with a for(), I can see the bytes using a printf() for (int n=0; n<sizeof(buff); n++) {

Is it possible to set a User-Agent when reading a remote file using readfile() in php?

柔情痞子 提交于 2019-12-23 02:05:29
问题 For example, in cURL I can use curl_setopt($curlrequest, CURLOPT_USERAGENT, 'myuseragent'); in order to change the User-Agent when I'm requesting the page specified in $curlrequest . But can I do something similar with readfile() ? 回答1: Yes, you can set a user_agent property in your php.ini config file or via ini_set() at runtime. See http://php.net/manual/en/filesystem.configuration.php#ini.user-agent (via http://php.net/manual/en/wrappers.http.php) Update An example (as requested) ini_set(

what is the fastest way to get dimensions of a csv file in java

不羁岁月 提交于 2019-12-22 17:53:11
问题 My regular procedure when coming to the task on getting dimensions of a csv file as following: Get how many rows it has: I use a while loop to read every lines and count up through each successful read. The cons is that it takes time to read the whole file just to count how many rows it has. then get how many columns it has: I use String[] temp = lineOfText.split(","); and then take the size of temp. Is there any smarter method? Like: file1 = read.csv; xDimention = file1.xDimention;

Open local file in electron and render in wavesurfer.js

青春壹個敷衍的年華 提交于 2019-12-22 03:50:08
问题 I'm working on an app built with electron, it should work with wavesurfer.js to display a waveform representing the audio file. However, I'm having trouble opening the file using the fs module and pushing the file content to wavesurfer via a Blob. The file loads and everything seems to work but when decoding wavesurfer says Error decoding audiobuffer . Two things I thought maybe could influence this: The fs.readFile function takes an encoding as second parameter The Blob constructor takes an

Reading Files in Windows Phone 8: Value does not fall within the expected range

若如初见. 提交于 2019-12-20 04:16:47
问题 I'm really problems when open files stored in my project. I need open some files (pdf, html,...) and ever has the same problem: Value does not fall within the expected range . I have tried several ways: a) private async Task<string> ReadFileContentsAsync(string fileName) { StorageFolder foldera = ApplicationData.Current.LocalFolder; try { Stream filea = await foldera.OpenStreamForReadAsync("/Assets/Data/htm/" + fileName + ".htm"); ... } catch (Exception e) { Debug.WriteLine("ERROR

Counting jump(no of lines) between first two 'String' occurrences in a file

落爺英雄遲暮 提交于 2019-12-20 03:39:06
问题 I have a huge data file with a specific string being repeated after a defined number of lines. counting jump between first two 'Rank' occurrences. For example the file looks like this: 1 5 6 8 Rank line-start 2 4 8 5 7 5 8 6 5 4 6 4 1 5 7 4 Rank line-end 4 8 6 4 2 4 8 5 3 6 8 9 5 4 6 4 Rank You can notice that the string Rank is repeated every 3rd line. So the number of lines in a block is 4 for the above example. My Question is how do i get the number of lines using python readline(). I

Using endswith to read list of files doesn't find extension in list

跟風遠走 提交于 2019-12-20 01:58:50
问题 I am trying to get my python script to read a text file with a list of file names with extensions and print out when it finds a particular extension (.txt files to be exact). It reads the file and goes through each line (I've tested by putting a simple "print line" after the for statement), but doesn't do anything when it sees ".txt" in the line. To avoid the obvious question, yes I'm positive there are .txt files in the list. Can someone point me in the right direction? with open ("file_list

fread a lot slower for downloads than readfile

左心房为你撑大大i 提交于 2019-12-20 00:42:42
问题 I'm serving downloads from a URL to my users through a PHP script. When using readfile() I get the maximum download speed my connection can support (about 2.5MB/s) however when I use the fopen, fread, fclose route the download speed is very, very slow (about 1-2KB/s). Here's my code: header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $filename); header('Content-Transfer-Encoding: binary');