03-21-2006
Quote:
Originally Posted by matrixmadhan
when using sprintf make sure that you have enough storage allocated for that.
result could be bewildering if storage is not properly allocated. Can you please check with the size returned and size allocated.
Probably I suspect here.
yeah i thought that also, but inside the get_bpdvalue function
just before returning the output, i tried printing it and the value is printing properly, always 10 characters only.
my friend, an esql/c programmer too, verified that he also encountered the same error and resorted to using strcpy instead of sprintf, i resorted to that way too, but i just want to know whats causing such an error, and it doesnt always happen because some string returning functions behave properly on sprintf.
10 More Discussions You Might Find Interesting
1. Programming
hi all,
my requirement is to create a thread by calling another function.
i.e i dont call pthread_create directly from main, but by calling another function (createThd - below ), from main.
Example:
void *thread_function(void *arg) { /* thread function */
int i;
rc =... (3 Replies)
Discussion started by: wolwy_pete
3 Replies
2. Shell Programming and Scripting
Hi all,
I am very new to BASH shell programming. I need to return an integer from a function to the caller function. I did this:
but it keeps giving me wrong return:
Can someone help me out here, please?
Thanks (2 Replies)
Discussion started by: alirezan
2 Replies
3. Programming
hi
how can I return multiple values from a C function. I tried the following:
#include <stdio.h>
void foo(int id, char *first_name, char *last_name)
{
/*
this is just an example to illustrate my problem... real code makes
use of the "id" parameter.
*/
first_name = (char... (8 Replies)
Discussion started by: Andrewkl
8 Replies
4. Shell Programming and Scripting
Hello all,
I would like to know if it is possible to return a the result of a boolean expression from a function like this
function()
{
# some code
return ||
}
and what will be the return value ?
Thank you for help. (6 Replies)
Discussion started by: dolphin06
6 Replies
5. Shell Programming and Scripting
Hi All
In my script, I can call on several functions. I have a logging function that is called by any of these functions. What I would like is some way of identifying which function I am using and pass this to the log function as some parameter.
Is there some built in command or way of... (3 Replies)
Discussion started by: kingpin2502
3 Replies
6. Programming
I am working on a C/Unix application from last 2 years which communicates with other systems using proprietary format of my client. We have a function written in C which returns integer, which is response from other system to the request message initiated by my system. This return value is then... (1 Reply)
Discussion started by: dpmore
1 Replies
7. Programming
Hi guys.
how a functions such fdopen, ... can return pointer?
are these functions use static memory(variables)? (6 Replies)
Discussion started by: majid.merkava
6 Replies
8. Programming
Hi,
If I have a code like this, what are the potential problems do you see?
const char* const retString() {
return "hello"; /* string literal */
}
My questions are:
a) Since the string literal which is already a constant read only data (cannot be... (4 Replies)
Discussion started by: royalibrahim
4 Replies
9. Programming
H friends,
As we know, a function returns a value and that value is saved somwhere. like
int Sum( int x, int y )
{
return x + y;
}
Total = Sum( 10, 20 );
The value 30 is saved in variable Total.
Now the question is, what int value does the function main return, and where is it... (5 Replies)
Discussion started by: gabam
5 Replies
10. Programming
Hi All,
I am using malloc function for allocating dynamic memory.
When I am using below code on Linux server its working fine, but When I am trying the same code on HP UNIX server its returning NULL.
below is a fragment of code in which it is giving problem.
tmp = (format_tree... (4 Replies)
Discussion started by: Taher Saifuddin
4 Replies
LEARN ABOUT DEBIAN
hook_config_section
hook_config_section(3alleg4) Allegro manual hook_config_section(3alleg4)
NAME
hook_config_section - Hooks a configuration file section with custom handlers. Allegro game programming library.
SYNOPSIS
#include <allegro.h>
void hook_config_section(const char *section, int (*intgetter)(const char *name, int def), const char *(*stringgetter)(const char *name,
const char *def), void (*stringsetter)(const char *name, const char *value));
DESCRIPTION
Takes control of the specified config file section, so that your hook functions will be used to manipulate it instead of the normal disk
file access. If both the getter and setter functions are NULL, a currently present hook will be unhooked. Hooked functions have the highest
priority. If a section is hooked, the hook will always be called, so you can also hook a '#' section: even override_config_file() cannot
override a hooked section. Example:
int decode_encrypted_int(const char *name, int def)
{
...
}
const char *decode_encrypted_string(const char *name, const char *def)
{
...
}
void encode_plaintext_string(const char *name, const char *value)
{
...
}
int main(int argc, char *argv[])
{
...
/* Make it harder for users to tinker with the high scores. */
hook_config_section("high_scores", decode_encrypted_int,
decode_encrypted_string, encode_plaintext_string);
...
} END_OF_MAIN()
SEE ALSO
config_is_hooked(3alleg4)
Allegro version 4.4.2 hook_config_section(3alleg4)