stream

How to read a stream with comma separated values in C++?

倾然丶 夕夏残阳落幕 提交于 2021-01-28 09:49:11
问题 I would like to emphasize on a fundamental question below: Assume you have a CSV file and fill cells with Input Headers The code should read this from .csv file and write the results into .csv file. It is nice to also code output total number of cases, plus average of cases. Here is a taken sample form SO and I would like to see how this can be efficiently adopted to complete this basic example. void create() { // file pointer fstream fout; // opens an existing csv file or creates a new file.

C++ Detect if input doesn't satisfy conditions

孤街浪徒 提交于 2021-01-28 08:31:25
问题 Update: Please guid me through a clear answer and small example of usage I am reading data from a binary file in which the first number indicates the number of inputs or values to read, the second tells the length of the first input then the input itself, after that the length of the second input then the input itself and so on. So wrote the following code: std::ifstream infile(filename, std::ios_base::binary); unsigned int NumberOfInputs; infile.read((char *) &NumberOfInputs, sizeof(unsigned

When the input will stop?

自古美人都是妖i 提交于 2021-01-28 06:58:00
问题 Hi guys i have the following question: string s; std::cout << "give me a string" << std::endl; while (std::cin >> s){ std::cout << "give me a string" << std::endl; } cin.clear(); if s was an integer then i know that if i typed a char then the while would break. If it was an integer and typed a double the same would happened. But what about strings ?? Somewhere I read that in windows (as I am writting at netbeans in windows) you have to press ctrl+z and then it stops as it is taken as a false

Using Chronicle Map producing garbage while using Streams API

杀马特。学长 韩版系。学妹 提交于 2021-01-28 03:36:02
问题 Today I was experimenting with Chronicle Map. Here is a code sample: package experimental; import net.openhft.chronicle.core.values.IntValue; import net.openhft.chronicle.map.ChronicleMap; import net.openhft.chronicle.values.Values; public class Tmp { public static void main(String[] args) { try (ChronicleMap<IntValue, User> users = ChronicleMap .of(IntValue.class, User.class) .name("users") .entries(100_000_000) .create();) { User user = Values.newHeapInstance(User.class); IntValue id =

C++ How do streams allocate space for input?

佐手、 提交于 2021-01-28 03:18:16
问题 For example: // is type: std::istream // str type: std::string is >> str; How does this grow str to accommodate the input? It reads character by character and calls str.push_back() (or something similar)? Or does it have a mechanism for knowing the input size before reading the input? I realize that the standard most likely doesn't specify this details, but I am more interested in common implementations (e.g. gcc ). This question is a curiosity as in C you don't know beforehand how much to

Can you stream posts that have made it to “hot”?

◇◆丶佛笑我妖孽 提交于 2021-01-27 22:00:41
问题 So let's say that I want to stream posts from the subreddit "news". However the posts are very frequent and we can't say that every post is worthy. So I would like to filter the good posts by trying to stream the "hot" list. But I am not sure if that, or a similar thing is possible. Normally, this is what I do to stream posts: for submission in subreddit.stream.submissions(): if not submission.stickied: print(str(submission.title) + " " + str(submission.url) + "\n") And this would filter the

Why does System.Buffer.BlockCopy take int instead of long?

纵然是瞬间 提交于 2021-01-27 18:12:48
问题 Is there a reason System.Buffer.BlockCopy takes int parameters instead of long for the offset/length of the copy? Streams generally work with long , why would BlockCopy not have an overload that takes long , too? 回答1: Because prior to .NET 4.5, no object could exceed 2 gigabytes. So there was no reason to have more than an int to represent the length. Even in .NET 4.5, although an array can be more than 2 gigabytes in length, it can't have more than 2^31 items. So the maximum size of a byte[]

ffmpeg multiple rtsp cameras into sigle stream to youtube

北城余情 提交于 2021-01-27 15:01:27
问题 I have two rtsp ip cameras (dlink) and I want combine (merge) 2 stream in one video output and put it to yutube (live streaming). My first step is ok and my command is: ffmpeg -i "rtsp://xxxxxx:xxxxxx@192.168.1.164/live2.sdp" -i "rtsp://xxxxxx:xxxxxx@192.168.1.164/live2.sdp" -filter_complex " nullsrc=size=1600x448 [base]; [0:v] setpts=PTS-STARTPTS, scale=800x448 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=800x448 [upperright]; [base][upperleft] overlay=shortest=1 [base]; [base][upperright]

Fail to define an infinite stream

巧了我就是萌 提交于 2021-01-27 12:50:48
问题 I'm working on UPENN Haskell Homework 6 Exercise 5, trying to define a ruler function 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,... where the nth element in the stream (assuming the first element corresponds to n = 1) is the largest power of 2 which evenly divides n . I just came up with an idea to build it without any divisibility testing: data Stream x = Cons x (Stream x) deriving (Eq) streamRepeat x = Cons x (streamRepeat x) interleaveStreams (Cons x xs) (Cons y ys) = Cons x (Cons y

Is it possible to restream an internet radio using PHP? (PHP guru needed)

白昼怎懂夜的黑 提交于 2021-01-27 11:44:44
问题 Is it possible to restream an internet radio using PHP? Radio is available at port 8000. I would like to use my webserver and "transmit" the radio stream to port 80. Is it possible? I have already been googling it around and I found http://support.spacialnet.com/forums/viewtopic.php?f=13&t=16858&start=15 but it doesn't work for me. It does actually work. Before I just forget to change MIME type of the stream. I customized solution from previously mentioned URL (http://support.spacialnet.com