Sponsored Content
Top Forums Programming using c++ and c standard I/O functions Post 302289481 by JamesGoh on Thursday 19th of February 2009 06:24:15 PM
Old 02-19-2009
using c++ and c standard I/O functions

Is it not a healthy practice to mix C and C++ standard I/O functions together

e.g.
Code:

string name; // this is a declared instance of the string class in C++

printf("\nPlease enter your name: ");
cin >> name;

I did something similar in a program Im designing, and used it several times across my code. The first instance worked, however the second time I called it, the program crashed on me.

Is it generally a good idea to do this ? If not, why ?

thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Use of functions

Hi my shell is tcsh can I have functions in my shell scripting? Is the below shell script correct. Can I have two functions and call one of them as required. ---------- echo "functions" f1 f1 () { echo "hello" } f2 () (1 Reply)
Discussion started by: amitrajvarma
1 Replies

2. UNIX for Advanced & Expert Users

To know the standard

Dear all, I have a need to find the standard of my system such as POSIX. How can I know that. Is there any way to find it. I am using GNU/Linux. (2 Replies)
Discussion started by: nagalenoj
2 Replies

3. Programming

Standard UNIX functions

Hi everybody, first of all i apologize if my thread's title doesn't make much sense,but i coudn't find a more appropriate name :) Then i apologize about my question,which probably will sound trivial for you :) :) I am working on a program which is being tested in Linux but the final target is... (2 Replies)
Discussion started by: Zipi
2 Replies

4. Shell Programming and Scripting

standard error to standard out question

Hi there how can i get the result of a command to not give me its error. For example, on certain systems the 'zfs' command below is not available, but this is fine becaues I am testing against $? so i dont want to see the message " command not found" Ive tried outputting to /dev/null 2>&1 to no... (5 Replies)
Discussion started by: hcclnoodles
5 Replies

5. UNIX for Dummies Questions & Answers

Help with functions

Hi, I am exploring with defining functions in my BASH shell scripts. However, I am bit confused about how to pass parameters to my functions. I was under the impression that you must do something like the following: Define a function called "sample_function": function sample_function {... (3 Replies)
Discussion started by: msb65
3 Replies

6. UNIX for Dummies Questions & Answers

Redirect Standard output and standard error into spreadsheet

Hey, I'm completely new at this and I was wondering if there is a way that I would be able to redirect the log files in a directories standard output and standard error into and excel spreadsheet in anyway? Please remember don't use too advanced of terminology as I just started using shell... (6 Replies)
Discussion started by: killaram
6 Replies

7. Shell Programming and Scripting

Standard out and standard error

I need to run a cronjob and in the cronjob I execute a script that if there is an error produces standard error so I do /RUNMYSCRIPT 2> mylogfile.log However, if it runs correctly, I don't get a standard error output, I get a standard out output. How do I redirect both standard error and... (2 Replies)
Discussion started by: guessingo
2 Replies

8. UNIX for Dummies Questions & Answers

== vs -eq and functions

Hey I have a question.... what is the difference between using == vs -eq when testing in WHILE loops. I use the following test that only worked with == signs.... if why do i need == and not -eq? 2. I need to re-use some code in a couple places in this script. is functions my best... (5 Replies)
Discussion started by: danieldcc
5 Replies

9. Shell Programming and Scripting

How to execute functions or initiate functions as command line parameters for below requirement?

I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line if then... (8 Replies)
Discussion started by: saku
8 Replies

10. Programming

Newline in ANSI-C standard functions

Can someone outline the "best practice" (if any!) to handle newline in ANSI-C standard library functions? I had some confusion with these functions recently related to char array and char pointer. puts(), printf(), strcpy(), strncpy(), memset(). I seem to understand their basic use, but got... (6 Replies)
Discussion started by: yifangt
6 Replies
LISTRES(1)						      General Commands Manual							LISTRES(1)

NAME
listres - list resources in widgets SYNOPSIS
listres [-option ...] DESCRIPTION
The listres program generates a list of a widget's resource database. The class in which each resource is first defined, the instance and class name, and the type of each resource is listed. If no specific widgets or the -all switch are given, a two-column list of widget names and their class hierarchies is printed. OPTIONS
Listres accepts all of the standard toolkit command line options along with those listed below: -all This option indicates that listres should print information for all known widgets and objects. -nosuper This option indicates that resources that are inherited from a superclass should not be listed. This is useful for determining which resources are new to a subclass. -variable This option indicates that widgets should be identified by the names of the class record variables rather than the class name given in the variable. This is useful for distinguishing subclasses that have the same class name as their superclasses. -top name This option specifies the name of the widget to be treated as the top of the hierarchy. Case is not significant, and the name may match either the class variable name or the class name. The default is ``core''. -format printf-string This option specifies the printf-style format string to be used to print out the name, instance, class, and type of each resource. X DEFAULTS
To be written. SEE ALSO
X(7), xrdb(1), appropriate widget documents BUGS
On operating systems that do not support dynamic linking of run-time routines, this program must have all of its known widgets compiled in. The sources provide several tools for automating this process for various widget sets. COPYRIGHT
Copyright 1994 X Consortium See X(7) for a full statement of rights and permissions. AUTHOR
Jim Fulton, MIT X Consortium X Version 11 listres 1.0.3 LISTRES(1)
All times are GMT -4. The time now is 10:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy