Sponsored Content
Top Forums Programming Help - Cast converts default int return type Post 302115293 by porter on Monday 23rd of April 2007 08:06:32 PM
Old 04-23-2007
You don't show what type the function is supposed to be returning. What type is the "return (-1);" supposed to be returning. If it's not some kind of int or float you are in trouble.

eg

void *func(void)
{
return -1;
}

is an error, where as

int func(void)
{
return -1;
}

is not.
 

9 More Discussions You Might Find Interesting

1. Programming

Return value (int) from main to calling shell

What is the sytax to return an int from C program main back to calling shell? #!/usr/bin/ksh typeset -i NO_RECS $NO_RECS=process_file # Process file is a C program that is set up to return an int from main. The #program complies with no issues, but an error is generated when the... (3 Replies)
Discussion started by: flounder
3 Replies

2. UNIX for Dummies Questions & Answers

int open(const char *pathname, int flags, mode_t mode) doubt...

hello everybody! I want to create a file with permissions for read, write, and execute to everybody using C, so I write this code: #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main(){ int fileDescriptor; fileDescriptor =... (2 Replies)
Discussion started by: csnmgeek
2 Replies

3. Red Hat

cast from const void* to unsigned int loses precision

Hello everey one, here i am attempting to compile a c++ project .it's throughing the following errors. my machine details are as follows: Linux chmclozr0119 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:19 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux errors: ===== Generating... (0 Replies)
Discussion started by: mannam srinivas
0 Replies

4. Programming

Need help in storing command line argument argv[2] to a variable of int type

The following program takes two command line arguments. I want the second argument (fileCount) to be stored/printed as a int value. I tried my best to typecast the char to int (check the printf statement at last) but is not working...the output is some junk value. This program is in its... (3 Replies)
Discussion started by: frozensmilz
3 Replies

5. Shell Programming and Scripting

Find command return type

Hi all does find command return anything if the file to be searched is not found? Like if I search from a file in a dir does it return false or null if the file is not found? Please suggests. (3 Replies)
Discussion started by: Veenak15
3 Replies

6. Programming

Handle int listen(int sockfd, int backlog) in TCP

Hi, from the manual listen(2): listen for connections on socket - Linux man page It has a parameter called backlog and it limits the maximum length of queue of pending list. If I set backlog to 128, is it means no more than 128 packets can be handled by server? If I have three... (3 Replies)
Discussion started by: sehang
3 Replies

7. Shell Programming and Scripting

what is the default return type of localtime() in perl?

Hi, I have given like this to get the time of the sub routine. my $start = localtime(); print "\n start time: $start \n"; Output start time: Fri Apr 29 01:01:31 2011 I want to know what is the format of the time. I am not able to follow is is HH:MM:SS or MM:HH:SS os... (2 Replies)
Discussion started by: vanitham
2 Replies

8. Programming

How to pass int and return string in C?

hi I want to write a function which takes int as input and returns a string like this. char GetString(int iNo) { switch(iNo) { case 0: return "Zero"; break; case 1: return "One"; break; } } void main() { int i; printf("Enter... (1 Reply)
Discussion started by: atharalikhan
1 Replies

9. Programming

Struct as return type

Hello all, I am trying to define a function with return type as struct, but seem to be failing. Error I am receiving is following .CC error: prototype for 'RpcHOData L1ITMu::MBLTCollection::getUnassociatedHORpcClusters(double)' does not match any in class 'L1ITMu::MBLTCollection' struct... (1 Reply)
Discussion started by: emily
1 Replies
XmCvtXmStringTableToTextProperty(library call)							    XmCvtXmStringTableToTextProperty(library call)

NAME
XmCvtXmStringTableToTextProperty -- A function that converts from XmStringTable to an XTextProperty Structure SYNOPSIS
#include <Xm/Xm.h> int XmCvtXmStringTableToTextProperty (display, string_table, count, style, text_prop_return) Display *display; XmStringTable string_table; int count; XmICCEncodingStyle style; XTextProperty *text_prop_return; (void) DESCRIPTION
XmCvtXmStringTableToTextProperty converts the XmStrings in the specified XmStringTable into an XTextProperty structure. The function sets the encoding member of text_prop_return to an Atom for the specified display naming the encoding determined by the speci- fied style, and it converts the first count compound strings in the specified XmStringTable to this encoding for storage in the text_prop_return value member. Following are the possible encoding styles: XmSTYLE_COMPOUND_STRING The encoding is _MOTIF_COMPOUND_STRING. The function converts each specified XmString to a compound string in Byte Stream format. XmSTYLE_COMPOUND_TEXT The encoding is COMPOUND_TEXT. The function converts each specified XmString to compound text. XmSTYLE_LOCALE The encoding is the encoding of the current locale. The function converts each specified XmString to the encoding of the current locale. XmSTYLE_STRING The encoding is STRING (plain C strings encoded in ISO8859-1), and the function converts each specified XmString to STRING. XmSTYLE_TEXT If all specified XmStrings are fully convertible to the encoding of the current locale, the encoding is the encoding of the cur- rent locale, and the function converts each specified XmString to the encoding of the current locale. Otherwise, the encoding is COMPOUND_TEXT, and the function converts each specified compound string to compound text. XmSTYLE_STANDARD_ICC_TEXT If all specified XmStrings are fully convertible to STRING, the encoding is STRING, and the function converts each specified XmString to STRING. Otherwise, the encoding is COMPOUND_TEXT, and the function converts each specified XmString to compound text. display Specifies the connection to the X server. string_table Specifies a set of XmStrings. count Specifies the number of XmStrings to be converted in string_table. style Specifies the manner in which the property is encoded. text_prop_return Returns the XTextProperty structure. To free the storage for the value member of the XTextProperty, use XtFree. RETURN VALUES
If conversion depends on the locale and the current locale is not supported, the function returns XLocaleNotSupported. In both of these cases, the function does not set text_prop_return. To determine whether the function is guaranteed not to return XLocaleNotSupported, use XSupportsLocale. RELATED INFORMATION
XmCvtXmStringToByteStream(3), XmCvtTextPropertyToXmStringTable(3), and XmStringTable(3). XmCvtXmStringTableToTextProperty(library call)
All times are GMT -4. The time now is 09:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy