|
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
|
DH came into our room one night with an idea for the perfect first name for a girl if this baby is a girl. We're all set on a boy name and have been forever.
I am a little stuck on a middle name, though. I want it to start with a C, but can't use Caroline...
Started by alileecam on
, 21 posts
by 14 people.
Answer Snippets (Read the full thread at thebump):
My daughter....
All great suggestions.
I thought I'd get a few ideas for a middle name.
Just didn't want to share yet.
Of girls names that start with C...they'd all make great middle names when paired with the right FN No, it's not missing.
|
|
It doesnt really matter where I set my A/C it only seems to operate out of the defrost (top) and center location at the same time, making neither too strong. When I first got it, after a few minutes of driving I would here a thump and it would swap to...
Started by motorsports3 on
, 15 posts
by 5 people.
Answer Snippets (Read the full thread at jeepforum):
Do all the various modes work? In other words, if you select "AC", do you get air only out of the vents? What about when you select "HEAT"--is it only out of the floor? What happens when you select "DEFROST"--is it only out of the defroster slots?
Describe... .
|
|
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.
|
|
Middle C I recently purchased a nifty fifty, and so have not removed it from the camera for several days. I was looking for something to shoot last night and I happened upon my daughter's piano...I decided to pick out Middle C (I got some of B, too!)....
Started by Bend The Light on
, 4 posts
by 2 people.
Answer Snippets (Read the full thread at thephotoforum):
Cheers
Well, you could keep....
Want to just pick out one key, as I was aiming for the Middle C, but I may be able to keep that idea one key, as I was aiming for the Middle C, but I may be able to keep that idea with just a part.
|
|
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.
|