gcount returns 0
Type: Posts; User: Prodiga1
gcount returns 0
Those results were before the read.
After the read, open returns 1; good returns 0; end returns 1; and bad returns 0 (??)
myFile.is_open returns 1
myFile.good returns 1
myFile.eof returns 0
I'm trying to read the contents of a file using the ifstream constructs. I've written a program that is a carbon copy off the website, under Reading From a File:
C++ Binary File I/O
1...
Thanks everyone :]
Hi all--
I'm writing a program that initializes an integer double pointer to NULL, and realloc's it's size each time a particular method is called. Something like:
int** list = NULL;
...
Got it. Thanks for the help, it's immensely appreciated.
That makes sense.
On the same token, why is:
1) char** stringArray = {"string1", "string2"}; //not allowed
2) char* stringArray[] = {"string1", "string2"}; //allowed
but
So I guess my question is: why are you allowed to assign a pointer to a string literal, and not a pointer of a double pointer to a string literal? (aka. char* strlit = "string" but not char**...
Think about obtaining the top section of the triangle, that is:
0
01
012
0123
01234
012345
How would that be accomplished?
I'm reasonably new to c and dynamic memory allocation really confuses me.
Take this code snippet:
#include <stdio.h>
#include <stdlib.h>
int main() {
Brilliant! Thanks cas
Think of separating the problem into two halves: one for the top half of the triangle and one for the bottom half
Hi all--
This issue is completely perplexing me, the following is code that reads in lines from a file and is supposed to copy each line into an array:
235 ...
Thanks!
I'm working with code that grabs strings from a file and then works with said strings in different ways.
I would like to check if the first character in a char* is a #:
FILE* file =...
Why is it fundamentally better to use the syntax:
if(42 == answer)
as opposed to:
if(answer == 42)
Having made the aforementioned change I get the following error:
Undefined symbols:
"KeyValueComparator::operator()(KeyValuePair, KeyValuePair) const", referenced from:
_main in...
This has been driving me insane, and I'm not sure what's wrong:
I have a header file (KeyValueComparator.h):
#ifndef KEY_COMP
2 #define KEY_COMP
3
4 #include <string>
5 #include...
I have two char array variables:
char* key set to "foo"
and char* test set to "bar"
When I attempt a strcmp(key, test), my c program seg faults.
What's going on here?
Ok.
Does that method do what it is intended to do? Create a count_table_t pointer object and return it?
Hi--
I'm having trouble defining a method that is supposed to return a pointer to a struct:
count_table_t* table_allocate(int size)
{
count_table_t *test;
...