Hello
Just wanted to sound people out on methods of transferring data from a .csv file into a custom built container which will provide the row and cell values of a spreadsheet. I'm working on a...
Type: Posts; User: officedog
Hello
Just wanted to sound people out on methods of transferring data from a .csv file into a custom built container which will provide the row and cell values of a spreadsheet. I'm working on a...
oh yes, missed that one. updated version:
char * GC_GetUserInputDyanmicV2() {
int baseSize = 64;
char c;
char * buffer = malloc(sizeof(char) * baseSize);
if (buffer...
Really appreciate the help. Thanks. Just for completeness, I post the final(ish) version of the function. I made initial buffer as 64 to decrease likelihood of resizing
char *...
OK I understand now. Thanks for keeping an eye on this, sebastiani. Really appreciate it. So, the reason it worked fine was because my call to realloc didn't need to find a block of memory...
Thank you for this feedback. It's helping a lot to build some confidence
I rewrote the function with the larger temporary storage, rather than resizing with realloc. It still seems to work OK. ...
I have worked further on my efforts at making a function which dynamically allocates memory to store a string from user input. This time I have added an extra bit so it will resize (I hope)...
Thanks again bithub. I think this is also what tabstop said on page 1. I get it now. The reason I didn't think it was necessary was because '\n' is the trigger for flushing to the input buffer. ...
Thanks for pointing this out bithub, I appreciate your help. Odd how such a simple loop can hurt the brain. I think you are right and have modified the code but putting index++ into the initial...
Just to add a progress notes:
I have read up on the difference between
char array[] = "a string";
and
char * pString = "a string"
Some of the things I read were
a) "a string" is a string...
Thanks for replies. This a great forum, very helpful. I remember how painful arrays and array pointers are! I know this is all really basic stuff, and I appreciate the help to remember some of it....
Thanks kennedy. I seem to remember there was something quite useful with fgetc, but can't quite remember what it was exactly! Probably something to do with parsing the file, like csv's.
Well...
Thanks for the replies. I am learning this very slowly. So, my understanding is that if I want to read input from the keyboard, because '\n' flushes the character strokes to the input buffer for...
Just a bit more experimentation with fgetc
So if I have a program which does this:
int c;
c = fgetc(stdin);
c = fgetc(stdin);
that's really helpful, thanks for the speedy reply bithub.
Thank you for these comments. I am working through this puzzle bit by bit, so hopefully it will come good in the end.
Current problem I'm having is getting a good understanding of stdin and the...
Thanks for these quick replies
MTK - I had read somewhere about the difficulties in using scanf so have avoided this in the past. I had wanted such a generic 'whatever the user throws at us'...
I am revisiting C strings, trying to get hang of the pesky things. I am attempting to make a set of functions to get, parse and manipulate strings etc.
This is my first function which gets user...
Hello all
I am trying to make a database which consists of references for my research project. Entries to the database consist of either journal articles, book chapters, books or websites. Each...
Thanks for the quick replies Tabstop and c++0x
Interesting idea c++0x. Perhaps this would be OK as the class isn't that large. Just checking my understanding here - that the instance created...
I'm working my way steadily into the C++ stuff and was wondering if the following is OK. (I'm making a clone of tertis for practice with SDL.)
I have a class "Block" which will generate a random...
Brilliant. Thanks mike_g, the delay you suggested worked perfectly - quietened everything down a treat. After your post I put a cout << counter into the while loop and sure enough... laptop was...
Hello all
I'm just running through a few tutorials at the moment on SDL. I keep noticing that some of them make my laptop go into over-drive - lots of activity on the memory, even for simple...
Thanks for the replies. I really appreciate these thoughts. I think I was trying to go too fast and your comments have helped me do a rethink and rather than refactor my original code, I'll do a...
Thanks for the thought and link Salem. I have SAMS 'C++ in 21 days...' - but it's not on that list you gave or the recommended books on this website - which makes me wonder if it's any good as an...
Hello all
I'm trying to make a shift from C to C++. I'm starting by transferring some C code to C++ and in the process also get a better understanding of the underlying conceptual shift. Rather...