The comment regarding trying to free memory is patently incorrect as I specifically handled that case with
The long starting practice since the dawn of the C language is that if the argument to free() is a null pointer, no action shall occur. This was and is codified by all versions of the various C standards.
As regards the comment that bzero() is deprecated, yes it is deprecated on some platforms and in some standards and specifications but is not depreciated in others. I did not claim any particular conformance so the comment lacks standing.
The comment regarding trying to free memory is patently incorrect as I specifically handled that case with
Patently? Perhaps, if I understand you correctly. Incorrect? Too absolute for the case. Rather redundant, and most likely unnecessary like your use of bzero() in this case. Or the casting of the NULL for the same matter.
Of course, as you, I must make emphasis of what I did not "claim": I did not claim to be correct, nor did I wrote any comment or addition as a vehicle for your personal engagement.
At the risk of stating the obvious, at the top of the quote I wrote. A few things to consider. You take it or leave it, writing generally, that is.
Quote:
Originally Posted by fpmurphy
,
As regards the comment that bzero() is depreciated, yes it is deprecated on some platforms and in some standards and specifications but is not depreciated in others. I did not claim any particular conformance so the comment lacks standing.
While I never said "depreciated", and the emphasis was more in the question mark, the stated "lacking of standing", I leave it unchallenged for others to judge and make their own opinion, if any.
As for more information, to whoever has interest, bzero() is part of the Berkeley UNIX C library, and memset() is part of the AT&T UNIX C library. The C Standard Library favored memset() and adopted it, and bzero() became deprecated. The use of the latest, is discouraged in favor of portability.
So i am trying to read in file
readFile <GivenFile> modFile
looking for a regular file under the directories in the GivenFile and print them out is my over all goal.
basically I am looking for anything that looks like a directory in the given file and printing it out.
Since I am trying to do... (2 Replies)
All of my machines (various open source derivatives on x86 and amd64) store argv above the stack (at a higher memory address). I am curious to learn if any systems store argv below the stack (at a lower memory address).
I am particularly interested in proprietary Unices, such as Solaris, HP-UX,... (9 Replies)
when i run my program, i have a parameter, that i want to set the value to another string
i am using
int main(int argc, char **argv) {
char my_str=argv;
printf("%s",my_str);
return 0;
}
and i get
Segmentation fault
ran using
./my_prog /usr/share/dict/words hello1
... (2 Replies)
Hello All,
First post. I've been struggling with the following:
Given a char* string, I need to construct an "int argc, char *argv" style structure. What I'm struggling with most is handling escaped-whitespace and quotes.
e.g. the string:
char *s = "hello world 'my name is simon'... (10 Replies)
Hello all,
Had a quick question:
In a typical csh script should inputting via stdin (i.e. set i = $< ) increase the value of $#argv ?
echo enter an value:
set val= "$<"
if($#argv == 0) then
echo No args
else
echo The arg is $argv
so if a value is inputted #argv... (1 Reply)
this is in one of my scripts...
if ($#argv == 0) then
echo 'blah bla'
exit 0
endif
I want it to be something like this...
if ($#argv == 0 OR $argv >=3)
echo 'blah bla'
exit 0
endif
so when the arguments are none, or greater than three I want this "if then" to take over. how? I... (5 Replies)
Hi C experts,
I have the following code for adding command line option for a program
int main (argc, argv)
int argc;
char *argv;
{
char *mem_type; //memory type
char *name; //name of the memory
int addr; //address bits
int data; ... (5 Replies)
I searched on the forums. No advises.
I am using a previous source code. I changed the main function main(int argc, char **argv) in a function misc(int argc, char **argv). How do you use the argc and argv parameters? This is how I am calling the function :
char param;
strcat(param,"wgrib ");... (4 Replies)
I have a program which I wish to modify. It used to be run from the command line, but now I wish to change this so it can be used as a function.
The program has complex argument processing so I want to pass my paramters to as if it were being called by the OS as a program.
I have tried to... (2 Replies)