Alright so cin is a reference to an ifstream? Would I have to open the file before I pass it to myInputFunction? because if the open command was in myInputFunction, would that work with cin?
Type: Posts; User: Tom_Arch
Alright so cin is a reference to an ifstream? Would I have to open the file before I pass it to myInputFunction? because if the open command was in myInputFunction, would that work with cin?
Ok the program is a search program which searches a file for the first command argument, then prints out any line with that in it. If there's only one argument, it uses cin.
salami testdata.txt
...
Well if there is no file specified in argv[] I want to read from std input instead. How can that be implemented?
Hey all,
In Xcode, do you have to put the text file somewhere special for it to be read? My file opening code runs but is always .fail().
Also how can I make an ifstream from cin?
Thanks for...
so can you call a method of a class that has no instance, using ::?
I'm doing C++ on through xcode 3.1 too at the moment, so I might be able to help. From what I gather gcc is the Gnu C Compiler for C, C++ uses the g++ compiler.
When you click new project, you...
alright thanks quzah I'll try that
sorry I meant
else {
strcpy(filename, argv[i]);
}
Ok changed those two, still getting a seg fault though
for (i = 1; i < argc; i++){
.
.
.
else{
fprintf(stderr, "Usage: tvprogs [-h] [-f filterfile] epgXMLfile");
return...
Hey does anyone have any clue why filename is never getting allocated in the code below?
I read it afterwards and its giving me a seg fault.
for (i = 1; i < (argc + 1); i++){
if...
ah genius! thanks
How can I check if the -h operator is included in the command line? It also needs to be next to an html filename?
Hey my project (to print out a tv guide) is coming together now. I've tested the lesser parts, but now I need to pipe in an xml file of programmes I get off the net to test my printer.
The main...
Does anyone know how to create a makefile on mac OS X? I think it needs to be declared a unix executable file
What's the difference?
If you make a null-terminated string, then call printf() on it, will the null character cause a gap at the end of it?
What happens if you call printf() and the string isn't null-terminated?
Hey C forum, can someone give me ideas/ psuedocode for iteration through a linked list?
I'm passing in my super-struct epg which is like this:
struct epg {
DateTime epoch; /* The time...
Thanks for all this help mats, all these are things I just wouldn't have picked up on. I've now changed it. Please, any more tips would be great. Also I still can't visualize how to check if the...
shakes I just read the how to post code note
DateTime dateTimeFromString(const char *s)
{
DateTime result;
char year[5];
char month[3];
char day[3];
Sorry for the length
DateTime dateTimeFromString(const char *s)
{
DateTime result;
char year[5];
char month[3];
char day[3];
char hour[3];
char min[3];
Sorry I don't understand why I get a segfault? I've now changed it like:
char *test = NULL;
char *buff = NULL;
But gdb still gives me the KERN_PROTECTION_FAILURE at address: 0x00001ffa.
How...
The code in my main function is:
char *test;
char *buff;
DateTime firstTry;
strcpy(test, "20090312150317");
firstTry = dateTimeFromString(test);
makeDateString(firstTry, buff);
...
Hey I'm having trouble understanding my error message
"incompatible type for argument 1 of ‘makeDateString’"
The function in question has the declaration
void makeDateString(const DateTime...
Hey I need help to understand how to read integers from a continuous string. For example s might be "20090310150506" (the double-quotes are not characters in the string), denoting 2009/03/10...