Hi,
Maybe isn't a good or relevant question, so please don't kill me.
Java's default encoding is ASCII. Yes? (See my edit)
When a textfile is encoded in UTF-8? How does a Reader know that he has to use UTF-8?
The Readers I talk about are:
FileReaders
BufferedReaders from Sockets
A Scanner from System.in
...
EDIT:
So the encoding ...
Hi,
I want to write a BigInteger to a file.
What is the best way to do this.
Of course I want to read (with the program, not by human) it from an inputstream.
Do I have to use an ObjectOutputStream or are there better ways?
The purpose is to use as less bytes as possible.
Thanks
Martijn
...
Hi All,
Sorry about the lame title.
I have a project I'm working on and I would appreciate any suggestions as to how I should go about doing the IO stuff.
Ok, I have 3 text files. One file contains many many lines of text. This is the same for the other 2 files. Let's call them File1, File2 and File3.
I need to create a text file, fo...
It's error. What's wrong of my codes?
#include "stdafx.h"
#include "stdlib.h"
#include "ctype.h"
int _tmain(int argc, _TCHAR* argv[])
{
FILE* input;
int num;
int numCount = 0;
input = fopen("123.txt", "r");
if (!input)
{
printf("No file \a\n");
exit (101);
}
while ((fscanf(input, "%d", &num)) == 1)
...
How can I check in C# if a specific path is a directory?
...
Hi all,
I want to master certain raw protocols to learn about TCP Stream resuming.
I am versed in .Net sockets, and would like to initiate a TCP stream so:
Socket socket = new Socket(Tcp)
socket.connect(IPAddress);
socket.send(new byte[]{155});
socket.close();
Then be able to read the raw IO network card data sent/recieved and save ...
I'm developing a small haskell program that uses an external static library I've developed in C++. It accesses the lib through ghc's FFI (foreign function interface). Inside this library I would like to do some output to the console. However, it looks to me like the c++ side of things does not have a correct handle to stdout because outp...
Hi All,
Can somebody please help me fix my code.? I can't see where I'm going wrong. It just doesn't do what it should be doing.
It should read a file line by line (every line contains 1 url), and then foreach url in the string it will visit that url and extract title, url, and body text, and then save it to a file but it just doesn't ...
Hi all,
Title says it all. I'm looking for a C++, async io library that should be compatible with both unix and windows systems.
What are some good libraries?
Is this asking too much for a library that does both systems?
What are peoples' experiences with this matter?
...
I've been trying to convince a friend of mine to avoid using dynamically allocated arrays and start moving over to the STL vectors. I sent him some sample code to show a couple things that could be done with STL and functors/generators:
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#define EVENTS 100000...
Hello world !
I am developing, in VB.Net, an application that reads from text files using a FileStream Object. I do not use a StreamReader, since the buffering it does makes it impossible to use Seek.
Those text files form a database, with both index and data files. In index files, all fields are fixed-length, which is not the case in ...
The below function results in infinite loop if a string is entered as input.
istream & inputFunc(istream &is)
{
int ival;
// read cin and test only for EOF; loop is executed even if there are other IO failures
while (cin >> ival, !cin.eof()) {
if (cin.bad()) // input stream is corrupted; bail out
...
How to print integer literals in binary or hex in haskell?
printBinary 5 => "0101"
printHex 5 => "05"
Which libraries/functions allow this?
I came across the Numeric module and its showIntAtBase function but have been unable to use it correctly.
> :t showIntAtBase
showIntAtBase :: (Integral a) => a -> (Int -> Char) -> a -> String...
Hi,
I have seen following code for getting the file into array, which is in turn used as a parameter for SQL command inserting it into a blob column:
using (FileStream fs = new FileStream(soubor,FileMode.Open,FileAccess.Read))
int length = (int)fs.Length;
buffer = new byte[length];
int count;
int sum = 0;
while ((count = fs.Read(buffer...
Is there a way to programmatically determine how busy a physical disk is in C# without using a System.Diagnostics.PerformanceCounter?
I ask because the documentation for System.Diagnostics.PerformanceCounter states that the user requires elevated priveleges and must be adminitrator or member of performance counters user group. I have n...
Edit2: I just want to make sure my question is clear: Why, on each iteration of AppendToLog(), the application uses 15mb more? (the size of the original log file)
I've got a function called AppendToLog() which receives the file path of an HTML document, does some parsing and appends it to a file. It gets called this way:
this.user_ema...
What is the motivation for Scala assignment evaluating to Unit rather than the value assigned?
A common pattern in I/O programming is to do things like this:
while ((bytesRead = in.read(buffer)) != -1) { ...
But this is not possible in Scala because...
bytesRead = in.read(buffer)
.. returns Unit, not the new value of bytesRead.
S...
Hi,
I want to create a hidden folder using java application. That program should work across platform. So How to write a program which can create hidden folder.
I have tried using
File newFile = new File("myfile");
newFile.mkdir();
It creates a directory which is not hidden.
...
Like it says in the tile: what does The last statement in a 'do' construct must be an expression mean? I ended my do block with a putStrLn like it shows in several examples I've seen, and i get an error.
Code:
main = do
args <- getArgs
file <-readFile "TWL06.txt"
putStrLn results
And i just realized why it's like that.......
Hello all,
One line of background: I'm the developer of Redis, a NoSQL database (http://code.google.com/p/redis). One of the new features I'm implementing is Virtual Memory, because Redis takes all the data in memory. Thanks to VM Redis is able to transfer rarely used objects from memory to disk, there are a number of reasons why this w...