|
If I have a large binary file (say it has 100,000,000 floats), is there a way in C (or C++) to open the file and read a specific float, without having to load the whole file into memory (i.e. how can I quickly find what the 62,821,214th float is)? A second...
Started by Switch on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
You know the size of a float is sizeof(float) , so multiplication can get you to the correct position:
FILE *f = fopen(fileName, "rb"); fseek(f, idx * sizeof(float), SEEK_SET); float result; fread(&result, sizeof(float), 1, f);
Similarly, you can write... .
|
|
I want to have a while loop do something like the following, but is this possible in c++? If so, how does the syntax go?
do { //some code while( expression to be evaluated ); // some more code }
I would want the loop to be exited as soon as the while ...
Started by Silmaril89 on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
The while statement can't be placed in the middle.
// Insert at favorite evaluates it at the top (or bottom) of the loop .
You should move the condition to the middle of the loop(?):
while (true) { ...
|
|
I have a linked list with a c-style ctor and dtor.
I just got too frustrated when this if statement decided not to test true, putting me in an infinite loop. I dont understand why it will never test true.
I am trying to delete a node (the address of a...
Answer Snippets (Read the full thread at stackoverflow):
Assuming that data_ is a pointer to something and what it points to has operator== defined or is ... .
You don't show where node comes from or how data_ is defined, but if it is a pointer type, you probably need to compare the contents , not the addresses .
|
Ask your Facebook Friends
|
Write a c program that is capable of accepting first name, middle name, last name and display the accep?
Started by Raju on
, 1 posts
by 1 people.
Answer Snippets (Read the full thread at yahoo):
|
|
I'm wondering how to use FFMpeg to grap the middle frame of a video. I've already written the C# to grab a frame at a certain time (ie pull one frame at second 3). But I've yet to figure out how to find the middle of video using the FFMpeg commands.
Started by Jon Dewees on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Ie for a 30 seconds video running at 15 that there's a universal way to find the middle of a video: Depending on the video codec and encoding.
By the other and divide by 2 to get the number of the middle frame.
|
|
I'm having to do some data conversion, and I need to try to match up on names that are not a direct match on full name. I'd like to be able to take the full name field and break it up into first, middle and last name.
The data does not include any prefixes...
Started by Even Mien on
, 16 posts
by 16 people.
Answer Snippets (Read the full thread at stackoverflow):
Are you sure the Full Legal Name will always include First, Middle and Last? I know people that....
Would be to tokenize on whitespace and assume that a three-token result is [first, middle, last "Van Buren") and multiple middle names.
|
|
Possible Duplicate:
Where do you declare variables? The top of a method or when you need them?
At least the last C standard allows you to declare variables in the middle of a function, it doesn't have to be right after a block begins or at the beginning...
Started by Frank Baskerville on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
And please, please, PLEASE don't go re-styling code in the middle.
Just because you're now compiling with a modern C compiler, doesn't mean the code was originally written that way.
|
|
Can anyone think of an efficient way (time wise) to trim a few selected characters from the middle of a string?
Best I came up with was:
public static string Trim(this string word, IEnumerable<char> selectedChars) { string result = word; foreach...
Started by Meidan Alon on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
c in word) { if (!charSet.Contains(c)) { builder.Append(c); } } return builder.ToString.
|
|
Is there any application to mimic the "Select to Copy and Middle Click to Paste" behaviour in Windows? I was hoping to find an AutoHotkey script for this, but I couldn't. Maybe someone here could quickly hack one for this :).
Started by swamplord on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at superuser):
Middlebutton is useful in browsers, so there is a short time (configurable) while you can paste with the middle button.
Conveinent middle button paste is also provided, but with a twist.
To press ctrl+c.
|
|
Is it possible to delete a middle node in the single linked list when the only information available we have is the pointer to the node to be deleted and not the pointer to the previous node?After deletion the previous node should point to the node next...
Started by Nitin on
, 16 posts
by 15 people.
Answer Snippets (Read the full thread at stackoverflow):
The initial suggestion was to transform:
a -> b -> c
to:
a ->, c
If you keep the information around, say, a map from address of node to address of the next
A -> B -> C -> D
If....
Exists a bug in what you are doing.
|