Hi Kip,
I have typedef'd an int vector as typedef vector<int> INTVEC;
Then typdef'd the map as typedef map <string, INTVEC > HEADINGMAP;
and an iterator as typedef...
Type: Posts; User: Sue Paterniti
Hi Kip,
I have typedef'd an int vector as typedef vector<int> INTVEC;
Then typdef'd the map as typedef map <string, INTVEC > HEADINGMAP;
and an iterator as typedef...
Thanks Kip,
I have included your code - but am now getting compile errors...
error C2143: syntax error : missing ',' before '&'
does hmap have to be declared elsewhere - in a .h ?? It says...
I have a map <string, vector of ints> and would like to display what I hope I have loaded into the map...however, it appears that I have to define a << operator that takes a type HEADINGMAP (my map...
I have a module pgm that contains only definitions and functions. I have not included a main() statement.
The module does have an associated header file.
When I compile the module I am getting...
Thanks for the critique - sebastiani - actually I am not trying to simplify anything - just trying to learn the syntax for passing parameters as pointers - and when it is appropriate to do so - as is...
HA HA HA HA (much hysterical laughter!!!)
I think it is working!!
I have passed the file mode (as a char array of 2) to the modules - and used that during the file opens.
It seems to be...
it must be getting late - i am babbling....
I have altered the fp to an fp1 (see last note)
I am now attemping to read the output'd binary file into the 2nd pgm - I have opened the file via the...
Interesting that my stat'd file_info (even though) a static - does not remain between calls....
I am trying to confirm that that is the case -
however, can you please confirm -
in the...
OK - here we go -
I have a call to the function
collectstat(fp);
???? collectstat(FILE *fp, name_type in_file) {
if (access(in_file,0) == 0) {
...
wow!!!
I'm not sure if I can process all that.....
yes, the input file is a text file that contains the names of files to be stat'd (one per record).
I was hoping to be able to read a...
The fp is defined in the calling pgm
ie FILE *fp;
and also in the mod.c module code
static FILE *fp
Sue
Some joy!!!!!
I removed the * from the return(*fp) - and it compiled and got a bit further in the pgm....
Can you please advise how I can pass the file pointer returned from the open to another...
Hammer,
Hmm, no luck - I am still getting compile errors "incompatible types on return"
The code I have is as follows:
in the module header:
Thanks Hammer,
I will try as you suggest....
in regards the passing of the file mode - yes, of course - I don't need to pass that.....
Thanks for your assistance
I will have another...
Hammer,
I have tried to incorportate some of your suggestions, but although the module compiles - I am getting "incompatible types in assignment" compile errors from the calling pgm.
In the...
Thanks Hammer,
I am having trouble with this pgm....the requirement is to have a pgm access a module -
Can you please tell me -
I have labelled my variables in the module (mod.c) as static -...
No - I think I am the idiot here!!
The calling pgm has the requirement to collect stat information for selected files and write the information to another file.
So - I thought I would call the...
I have a pgm calling a function in a module.
The program is to pass a file name to the module function - and then the module function will collect the stat information and return the stat info to...
I have a couple of programs which open files, and need to create a module which has the fopen code - and then pass the file and mode parameters to the module.
I have included code in my calling...
Can anyone suggest how I can check for a files existence prior to using it...
I have found a code called F_OK - but am not sure of the syntax to use it.
many thanks
Sue
I have managed to get some more information on my segmentation fault.
the error message is
home/spaterniti/wrkshops/b1: no such file or directory
I can see the file when I do a "ls" command...
Salem,
thanks - I have made your suggested changes.
The first program compiles and runs without error.
The second program compiles - but throws a segmentation fault error when it runs.
Can...
Thanks Salem and Shadow,
I'll try again:
This is the code I wrote to create the file.
#include <sys/types.h>
I have attached the code.
Salem, I have read the link you suggested, but am not sure what is the relation to my code problem.
Please advise.
Thanks
Sue
Hi Salem,
Here is the code that wrote the binary file.
regards
sue
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <time.h>