question
stringlengths
24
425
answer
stringlengths
5
405
In some C project, I have seen this code: ``` static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { (void)ud; (void)osize; /* some code not using `ud` or `osize` */ return ptr; } ``` Do the two casts to void serve any purpose?
It is there to avoid warnings from the compiler because some parameters are unused.
Is it possible to make the checkboxes in a list view control with LVS_EX_CHECKBOXES style tri-state (having BS_3STATE button style)? I'm using WTL but I'm OK manually sending messages around.
Yes, you need an ImageList with 3 images of a unchecked, checked and indeterminate checkbox. Call ListView_SetImageList() to assign the LVSIL_STATE image list. Manipulate LVITEM.state to display the kind of checkbox you want.
I'm having trouble using bool as a type compiling with ndk-build: ``` bool test = true; ``` error: 48: error: 'bool' undeclared (first use in this function) Any ideas?
boolis not a built-in type in C. You need to#include <stdbool.h>to get it.
Does anyone know of any C parser library for .NET? (I'm intending to parse C code into some form of object graph, so I can convert it to a different language.)
ANTLR can do what you'd like. It has a C preprocessor and ANSI C grammar. https://github.com/antlr/grammars-v4
I'm looking for sample code on how to use the TMS3705 RFid transponder base station IC to communicate with the TMS37157 RFid device. The TMS3705 datasheet is not very helpful - it only describes the physical interface. Either sample code or a good description of how to construct/send a transmit packet and receive/parse a receive packet would be very helpful.
The TMS3705 is used in thePaLFI Evaluation kit TMS37157. You find the reference to theFAQ.
Count amount of digits in a given number or input by the user.
Independent of programming language: floor(log10(x))+1 where x is your number (>0). If you want to handle 0 and negative numbers, I'd suggest something like this: x == 0 ? 1 : floor(log10(abs(x)))+1
I'm having trouble using bool as a type compiling with ndk-build: ``` bool test = true; ``` error: 48: error: 'bool' undeclared (first use in this function) Any ideas?
boolis not a built-in type in C. You need to#include <stdbool.h>to get it.
Does anyone know of any C parser library for .NET? (I'm intending to parse C code into some form of object graph, so I can convert it to a different language.)
ANTLR can do what you'd like. It has a C preprocessor and ANSI C grammar. https://github.com/antlr/grammars-v4
I'm looking for sample code on how to use the TMS3705 RFid transponder base station IC to communicate with the TMS37157 RFid device. The TMS3705 datasheet is not very helpful - it only describes the physical interface. Either sample code or a good description of how to construct/send a transmit packet and receive/parse a receive packet would be very helpful.
The TMS3705 is used in thePaLFI Evaluation kit TMS37157. You find the reference to theFAQ.
Count amount of digits in a given number or input by the user.
Independent of programming language: floor(log10(x))+1 where x is your number (>0). If you want to handle 0 and negative numbers, I'd suggest something like this: x == 0 ? 1 : floor(log10(abs(x)))+1
This is a tricky C question asked in interview: Write a program that does nothing, not even taking up memory. Is it possible to do so?
All programs use memory. When you run the program, the OS will set up an address space for the program, copy its arguments into its process space, give it a process ID and a thread, give it some file descriptors for I/O, etc. Even if your program immediately terminates you still use up this memory and CPU time.
I want to create a tool like mini task manager. I want to show all the running processes, cpu and memory usage. Can anybody tell me related api's which I can use for this. Any link to related web page will be appreciated. (I want dump of all the statistics of running processes, cpu and memory.) Thanks in advance.
To do that, you will need touse the tool help functions to get snapshotsof the system. Hereis a code example.
Is it this kind of thing: ``` for(;;) { statements; } ``` Or is it this: ``` for(initialisation;condition;updation) { } ``` I am looking for answers with references to a variety of sources.
Your first case (forwith empty expressions) is aninfiniteloop and the second one (with empty body of theforstatement) is anemptyloop
GCC has__builtin_prefetchto support prefetching. My question is how can I prefetch the data to a specific level of cache. For example, I only would like to prefetch the data toL2 cacheinstead of all the way toL1 cache.
__builtin_prefetchhas three arguments; the third one is the cache level. AFAICT, this has only effect on SSE, where it generates prefetchnta, prefetcht1, prefetcht2, prefetcht3, respectively.
I build the code, then when I try to run it, it executes and exits quickly . I am pretty sure that there is a way in the project configuration , but I forgot how .
You can always just usegetc()before the return. Enter a character and it will exit.. Or run the VSctrl+f5combination, or add a breakpoint if debugging.
What is the use of padding struct in C?
Some architectures will perform better if only aligned accesses are made, so putting 32-bit objects on 32-bit boundaries, and 64-bit objects on 64-bit boundaries can improve the speed of your application. Some architectures are completely incapable of making unaligned accesses, and on those architectures not padding can be a real disaster.
This question already has answers here:Closed12 years ago. Possible Duplicate:string to float conversion? how can i convert a string to float in c with only Libc?
You can usestrtodorsscanfto do this.
I want to create a tool like mini task manager. I want to show all the running processes, cpu and memory usage. Can anybody tell me related api's which I can use for this. Any link to related web page will be appreciated. (I want dump of all the statistics of running processes, cpu and memory.) Thanks in advance.
To do that, you will need touse the tool help functions to get snapshotsof the system. Hereis a code example.
This question already has answers here:Closed12 years ago. Possible Duplicate:string to float conversion? how can i convert a string to float in c with only Libc?
You can usestrtodorsscanfto do this.
I'm looking for a simple C Wrapper of zlib, to decompress a byte array. Anyone knows one ?
By wrapper function, you probably mean some simpler to use, more self-contained functions? Zlib contains them. Have a look in themanualunder "Utility Functions". You're probably look for: ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen));
How do I send UDP packet from aspecificinterface on Linux using C? Should I use bind? Is it possible to send UDP from the interface not having IP address? Thanks.
Use bind. You cannot send UDP packets via an interface that does not have an IP address, because UDP uses the Internet Protocol and the Internet Protocol requires an IP address.
I'm writing a C/CGI web application. Is there a library to parse a query string into something like aGHashTable? I could write my own but it certainly doesn't seem to be worth the effort to reinvent the wheel.
Theuriparserlibrary can parsequery stringsinto key-value pairs.
I want to learn C/C++ GUI Windows/Linux programming. Which IDE is more suitable? If I go with Visual Studio.NET, what are the pros and cons of it. Any IDE that supports both Windows and Linux?
TheQt Creator IDEworks for both Linux and Windows. If you want a more versatile development environment, Qt can integrate with Eclipse.
In .NET land, there's the tremendously usefulSystem.Windows.Forms.CheckedListBoxclass. What is the equivalent in Windows Common Controls land? (if any)
Turn a list view into one with checkboxes. If you want it similar to a ListBox, only use 1 column. ``` ListView_SetExtendedListViewStyle (handle, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); ```
Is there a specific reason to use ldiv or div instead of '/' or '%' to divide/modulus two variables?
Yes. C99 §7.20.6.2/2 says: Thediv,ldiv, andlldiv, functions computenumer / denomandnumer % denomin a single operation.
in Linux playing or recording some audio is just read or write /dev/dsp But how to do the same in windows ? (with C)
There is no static device name, you should usewaveOut*functions,hereis a nice example of using those APIs.
I want to define a function in C language which can take an unlimited number of arguments of any datatype. For example:printf(),scanf(), etc. Any idea on this?
To use variable number of arguments in C you need to include the header ``` #include <stdarg.h> ``` printf()in C is an example of function that takes variable number of arguments. ``` int printf(const char *fmt, ...) ``` More infohere
How can i get the last digit of an integer (or NSInteger) outputted to integer? example: ``` int time = CFAbsoluteGetCurrent(); int lastDigit; ```
Usemodulo: ``` int lastDigit = time % 10; ```
``` char program[3] = { 0x6a, 0x0a, 0xC3 }; //push 10; ret; char (*p)(void) = program; printf("char = %c \n", p()); ``` This code crashes. Why? The following code works ok: ``` char program[3] = { 0x90, 0x90, 0xC3 }; //nop; nop; ret void (*p)(void) = program; p(); ```
Because you need to cleanup your stack by popping from it. Read more on theretinstruction - it will load cs:ip with values from the stack!
can any one provide me a link for B-tree code in C,have understood the algorithm but still have problems in coding it
c++http://touc.org/btree.html c (slightly fancier than normal)http://code.google.com/p/high-concurrency-btree/downloads/list
In .NET land, there's the tremendously usefulSystem.Windows.Forms.CheckedListBoxclass. What is the equivalent in Windows Common Controls land? (if any)
Turn a list view into one with checkboxes. If you want it similar to a ListBox, only use 1 column. ``` ListView_SetExtendedListViewStyle (handle, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); ```
Is there a specific reason to use ldiv or div instead of '/' or '%' to divide/modulus two variables?
Yes. C99 §7.20.6.2/2 says: Thediv,ldiv, andlldiv, functions computenumer / denomandnumer % denomin a single operation.
in Linux playing or recording some audio is just read or write /dev/dsp But how to do the same in windows ? (with C)
There is no static device name, you should usewaveOut*functions,hereis a nice example of using those APIs.
I want to define a function in C language which can take an unlimited number of arguments of any datatype. For example:printf(),scanf(), etc. Any idea on this?
To use variable number of arguments in C you need to include the header ``` #include <stdarg.h> ``` printf()in C is an example of function that takes variable number of arguments. ``` int printf(const char *fmt, ...) ``` More infohere
How can i get the last digit of an integer (or NSInteger) outputted to integer? example: ``` int time = CFAbsoluteGetCurrent(); int lastDigit; ```
Usemodulo: ``` int lastDigit = time % 10; ```
``` char program[3] = { 0x6a, 0x0a, 0xC3 }; //push 10; ret; char (*p)(void) = program; printf("char = %c \n", p()); ``` This code crashes. Why? The following code works ok: ``` char program[3] = { 0x90, 0x90, 0xC3 }; //nop; nop; ret void (*p)(void) = program; p(); ```
Because you need to cleanup your stack by popping from it. Read more on theretinstruction - it will load cs:ip with values from the stack!
in Linux playing or recording some audio is just read or write /dev/dsp But how to do the same in windows ? (with C)
There is no static device name, you should usewaveOut*functions,hereis a nice example of using those APIs.
I want to define a function in C language which can take an unlimited number of arguments of any datatype. For example:printf(),scanf(), etc. Any idea on this?
To use variable number of arguments in C you need to include the header ``` #include <stdarg.h> ``` printf()in C is an example of function that takes variable number of arguments. ``` int printf(const char *fmt, ...) ``` More infohere
How can i get the last digit of an integer (or NSInteger) outputted to integer? example: ``` int time = CFAbsoluteGetCurrent(); int lastDigit; ```
Usemodulo: ``` int lastDigit = time % 10; ```
``` char program[3] = { 0x6a, 0x0a, 0xC3 }; //push 10; ret; char (*p)(void) = program; printf("char = %c \n", p()); ``` This code crashes. Why? The following code works ok: ``` char program[3] = { 0x90, 0x90, 0xC3 }; //nop; nop; ret void (*p)(void) = program; p(); ```
Because you need to cleanup your stack by popping from it. Read more on theretinstruction - it will load cs:ip with values from the stack!
I'm writing a CGI program in C to get an uploaded file through HTTP multipart/form-data. How is that Apache handles file uploads? How can I get the data?
You could use an established CGI library, such ascgic, which hascgiFormFileNamemethod for handling uploaded files.
From a compiled file, can I see which compiler has been used to generate the file?
There's also the good old 'strings' utility. Dumps all ascii-ish looking strings it finds in the binary. Different compilers embed different amounts of information in the binaries they produce, but many will actually include obviously identifying strings.
Does anyone have an idea how to convert char* to string. Actually, I have a function which returns value as char* and now i need to store/copy std::string. I have tried something like char *sResult = (char*)malloc(1024); std:string line; line= line+ sResult Thanks and regards, Sam
How about ``` std::string line(szResult); ```
For example I have a string<abc="xyz"> abc can change and so does the value xyz. I need a way to find out value which is between two double quotes. How do I do that in C? Any standard lib function I can use? without doing explicit pointer dance?
You have to browse the string. Everything you need is there :http://www.cppreference.com/stdstring/index.html
I want to decompile CHM file to HTML format . Is it possible using c or c++ ? Is there any c or c++ library to do this.
It is possible using C++. If you use Windows, you can do it using COM. An example you can findhere. This article is about C#, but it is done using COM interfaces and you can easily do the same in C++.
I wanna get string like 34,34;34,21;45,12;45,12(length is not certain.) I wanna dynamic memory allocation with realloc but i can't do it. How i can get like this characters to string?? it will be string={34,34,34,21,45,12,45,12}
You will have to know the length beforehand, and when you know that your buffer is too small for data that is going to be newly entered, use: ``` realloc(ptr, newLength); ```
I want to decompile CHM file to HTML format . Is it possible using c or c++ ? Is there any c or c++ library to do this.
It is possible using C++. If you use Windows, you can do it using COM. An example you can findhere. This article is about C#, but it is done using COM interfaces and you can easily do the same in C++.
What would be the best way to copy unsigned char array to another? For example: ``` unsigned char q[1000]; unsigned char p[1000]; strcpy (q,&p); ``` The above code does not work, it gives me error saying "cannot convert parameter 1 from unsigned char [1000] to char *".
As indicated by its name,strcpyworks on C string (which a unsigned char array is not). You should considermemcpy.
Ie, how to get keystrokes send directly to my program without waiting for the user to press enter. Basicly I'm trying get something like curses'scbreak()call. (But I can't use curses due a couple of bugs/misfeatures that I haven't been able to work around.) This seems like something that should just be a trival escape sequence, but I haven't been able find anything.
Lookuptermiosand thetcsetattrfunction.
I have a pointer that's holding 100 bytes of data. i would like to add 5 to every 2nd byte. example: ``` 1 2 3 4 5 6 ``` will become: ``` 1 7 3 9 5 11 ``` Now i know i can do a for loop, is there a quicker way? something like memset that will increase the value of every 2nd byte ? thanks
A loop would be the best way. memset() is efficient for setting a contiguous block of memory. Wouldn't be much help for you here.
From what Platform SDK? Which version? Where can be downloaded? link Thanks.
T_SafeVector.h is provided by Microsoft as part of what used to be called Platform SDK. Now Platform SDK has been superseded by the Windows SDK http://msdn.microsoft.com/en-us/windows/bb980924 Windows SDK = Platform SDK + .NET Framework SDK
I hadstruct point {(...)};defined. But with C90 it seems I have to do it with typedef. How do I do this correctly?typedef struct point {} point;?typedef struct {} point;?typedef struct point {};?
You can do: ``` typedef struct Point { ... } MyPoint; ``` and then use both kinds of declarations: ``` struct Point p1; MyPoint p2; ```
I'm writing a Python module in C and I intend to mmap largeish blocks of memory (perhaps 500 MB). Is there anything about working in the same process space as the Python interpreter that I should be careful of?
No, you're fine. On 32-bit systems, you could run out of virtual memory, or with virtual memory fragmentation not have a single chunk big enough to map as many huge files as you want. But that pitfall isn't particular to CPython.
I'm sorry if this was covered before, but I can't find it anywhere on StackOverflow. Basically I'm trying to run things that you usually run at a Windows command prompt: msiexec /i file.msi /q and other sort of commands from my C program. Is this possible? Thanks.
In windows using the Win APIShellExecutewill give you best control of your child process. However the other two methods mentioned by Dave18 and Pablo work as well.
I'm getting errors while compiling with-ansi -pedanticon lines that have// Comment here. Why does this happen? expected expression before '/' tokenstray '\347' in program Example codeint someVariable = 0; // Some comment I have many many errors of these, what is it?
C89 does not support C++-style comments.
What would be the best way to copy unsigned char array to another? For example: ``` unsigned char q[1000]; unsigned char p[1000]; strcpy (q,&p); ``` The above code does not work, it gives me error saying "cannot convert parameter 1 from unsigned char [1000] to char *".
As indicated by its name,strcpyworks on C string (which a unsigned char array is not). You should considermemcpy.
Ie, how to get keystrokes send directly to my program without waiting for the user to press enter. Basicly I'm trying get something like curses'scbreak()call. (But I can't use curses due a couple of bugs/misfeatures that I haven't been able to work around.) This seems like something that should just be a trival escape sequence, but I haven't been able find anything.
Lookuptermiosand thetcsetattrfunction.
I have a pointer that's holding 100 bytes of data. i would like to add 5 to every 2nd byte. example: ``` 1 2 3 4 5 6 ``` will become: ``` 1 7 3 9 5 11 ``` Now i know i can do a for loop, is there a quicker way? something like memset that will increase the value of every 2nd byte ? thanks
A loop would be the best way. memset() is efficient for setting a contiguous block of memory. Wouldn't be much help for you here.
e.g. quake engines have ``` typedef enum {qfalse, qtrue} qboolean; ``` When one does ``` static qboolean variable; ``` Is the variable's start-up value 0?
static and global variables are cleared by default, if there is no value assigned at initialization. In your examplevariablewill have the enum's equivalent of0, i.e.qfalse.
This question already has answers here:What are the best (portable) cross-platform arbitrary-precision math libraries? [closed](5 answers)Closed9 years ago. I need the fastest library that is available for C++. My platform will be x86 and x86-64 which supports floating points.
GMPLIB GMP is a free library for arbitrary precision arithmetic, operating on signed ... C++ class based interface to all of the above.
Which should I use to link for mysqlclient library? What is the difference between them? I can't seem to find the answer. Thanks.
Newer versions of the MySQL client distributions do not include the "_r" version. Some may have a symbolic link from libmyqslclient_r.a to libmyqslclient.a
Closed.This question isoff-topic. It is not currently accepting answers.Want to improve this question?Update the questionso it'son-topicfor Stack Overflow.Closed12 years ago.Improve this question Please let me know what this C inCprogramming and C++ programming is used for? I'm serious as this question was put in front of me in an interview.
Nothing at all. It was just the successor of B, which was a stripped-down version of BCPL.
I would like to write a custom GlusterFS Translator for file encryption with AES. Besides this rather rare description:http://europe.gluster.org/community/documentation/index.php/GlusterFS_Contributors_FAQ, is there any other documentation on writing a custom Translator?
Maybe HekaFS is what you need, it already has a encryption translator.
So I have G++ installed, I can eselycapture from main camera with OpenCV (at least 4 fps). But I also want to capture Live sound from mic. What are my options?
Take a look atQT for Maemo. It should handle the capturing part. Not sure about openCV though.
I'm having a hard time understanding what the WINAPI tag is with respect to c. For example: BOOL WINAPI CreateProcessA( ...); What exactly is this WINAPI tag, does it have more formal name, and is it part of c or implementation specific? Sorry if my question is a bit confusing. Many Thanks!
It is thecalling convention, normally defined as__stdcallfor Windows.
Is it possible to implement OS independent threading model of User Level Threads (ULT) in C/C++? In other words, can we break down a process logically into ULTs and dynamically make switches in between them?
Boost.Thread offers a fair amount of abstraction for cross-platform threading.
Which should I use to link for mysqlclient library? What is the difference between them? I can't seem to find the answer. Thanks.
Newer versions of the MySQL client distributions do not include the "_r" version. Some may have a symbolic link from libmyqslclient_r.a to libmyqslclient.a
Closed.This question isoff-topic. It is not currently accepting answers.Want to improve this question?Update the questionso it'son-topicfor Stack Overflow.Closed12 years ago.Improve this question Please let me know what this C inCprogramming and C++ programming is used for? I'm serious as this question was put in front of me in an interview.
Nothing at all. It was just the successor of B, which was a stripped-down version of BCPL.
I would like to write a custom GlusterFS Translator for file encryption with AES. Besides this rather rare description:http://europe.gluster.org/community/documentation/index.php/GlusterFS_Contributors_FAQ, is there any other documentation on writing a custom Translator?
Maybe HekaFS is what you need, it already has a encryption translator.
I need to find the path of where my program is running. Using argv[0] doesn't seem to work because the program has to be run on the windows console, for example,C:\ >player parameter1 parameter2and I only get player on argv[0]. How can I accomplish this?
You can use Windows'GetModuleFileNamefunction to obtain the path of the executable by setting thehModuleparameter toNULL.
Is it possible? ``` typedef struct { listLink *next; listLink *prev; void *data; } listLink; ```
Yes, with this syntaxis ``` struct list { int value; struct list *next; }; ``` or ``` typedef struct list { int value; struct list *next; } list; ```
Is there any way to get all opened sockets usingc++? I know thelsofcommand and this is what I'm looking for, but how to use it in ac++application? The idea is to get the FD of an opened socket by itsportnumber and thepid.
Just open the files in /proc/net, like /proc/net/tcp, /proc/net/udp, etc. No need to slog through the lsof sources. :)
i have to write an high efficiency sock reverse proxy in C/C++, so i was wondering, is there any library/framework to easily handle sockets, proxying, etc just to focus on the main part of the project (not the proxy itself :)) ? Something like the ACE framework but possibly i little bit smaller and/or proxy oriented ... Thanks
libeventis pretty good. ACE is horrible :)
I'm looking for a simple non-validating XML parser in either C or C++. Several years back I found one that was just a single file solution but I can't find it anymore. I'm after some links and suggested ones that are very small and lightweight ideally suited for an embedded platform.
Expat You can work with or without validation and in "streaming mode". It is very lightweight.
I'm looking for a simple non-validating XML parser in either C or C++. Several years back I found one that was just a single file solution but I can't find it anymore. I'm after some links and suggested ones that are very small and lightweight ideally suited for an embedded platform.
Expat You can work with or without validation and in "streaming mode". It is very lightweight.
if i have a variable from fgets for example fgets(question,200,stdin); how do i determine the size of the variable question without all the trailing blank elemets?
Usestrlen(3). Was there a question aboutmalloc(3)too?
Suppose there are two threads, the main thread and say thread B(created by main). If B acquired a mutex(say pthread_mutex) and it has called pthread_exit without unlocking the lock. So what happens to the mutex? Does it become free?
nope. The mutex remaines locked. What actually happens to such a lock depends on its type, You can read about thathereorhere
``` #define BS 1000 XDR *xdrs; char buf1[BS]; xdrmem_create(xdrs,buf1,BS,XDR_ENCODE); ``` I followed what the text book said but whenever I ran my program, it has segmentation fault. I think there is problem with xdrmem_create. Has anybody here been successful when using this function? (I'm using Ubuntu 10.10)
You didn't initialize the pointer. Fix: ``` XDR stream; xdrmem_create(&stream, buf1, BS, XDR_ENCODE); ```
Suppose there are two threads, the main thread and say thread B(created by main). If B acquired a mutex(say pthread_mutex) and it has called pthread_exit without unlocking the lock. So what happens to the mutex? Does it become free?
nope. The mutex remaines locked. What actually happens to such a lock depends on its type, You can read about thathereorhere
``` #define BS 1000 XDR *xdrs; char buf1[BS]; xdrmem_create(xdrs,buf1,BS,XDR_ENCODE); ``` I followed what the text book said but whenever I ran my program, it has segmentation fault. I think there is problem with xdrmem_create. Has anybody here been successful when using this function? (I'm using Ubuntu 10.10)
You didn't initialize the pointer. Fix: ``` XDR stream; xdrmem_create(&stream, buf1, BS, XDR_ENCODE); ```
This is my code: ``` int a1[][3]={{1,2,3,4,5,6},{4,5,6,5}}; int (*q)[3]; q=a1; ``` qis a pointer to an array of 3 integers. Buta1does not comply withq's type. Yet the assignment works and no error comes. Can anyone explain why?
The types do comply.a1is an array of length-3 arrays of ints.qis a pointer to a length-3 array of ints. An array decays to a pointer in most circumstances; this is one of them, so everything's fine!
What does the following code fragment (in C) print? ``` int a = 033; printf("%d", a + 1); ```
033is anoctal integer literaland its value is8*3+3 = 27. Your code prints28. An integer literal that starts with a0is octal. If it starts in0xit's hexadecimal. By the way, for an example's sake ``` int x = 08; //error ``` is a compile-time error since8is not an octal digit.
Is there any algorythm to sort an array of float numbers in one cycle?
If you mean one pass, then no. Sorting generally requires either O(N log N). Single-pass implies O(N). Radix sort takes O(N*k) with average key-length k. Even though it's linear time, it requires multiple passes. It is also not usually suitable for sorting floats.
I'am doing a program that deals with connecting to mysql server and accessing or writing data. I am wondering whether to do the connector part using connector for c or c++. I have heard that c connector is more stable than the c++ connector. Please do help me choose.. MySQL Connector/C or MySQL Connector/C++?
Go with the language you're the most comfortable with, and use the connector for that language.
I did the opposite by mistake and now i can't go back to the java enviorment. anyoune knows how? thanks.
There should be a button in the top right corner for changing perspectives. You can also get to it through theWindow > Open Perspectivemenu.
So how to create a function to return nearest up so nearest to 9 9+ 1 to given int leaving no remainder when divided by 2 int?
To round to the nearest int: ``` number+=(number & 1) ```
I'am doing a program that deals with connecting to mysql server and accessing or writing data. I am wondering whether to do the connector part using connector for c or c++. I have heard that c connector is more stable than the c++ connector. Please do help me choose.. MySQL Connector/C or MySQL Connector/C++?
Go with the language you're the most comfortable with, and use the connector for that language.
I did the opposite by mistake and now i can't go back to the java enviorment. anyoune knows how? thanks.
There should be a button in the top right corner for changing perspectives. You can also get to it through theWindow > Open Perspectivemenu.
I did the opposite by mistake and now i can't go back to the java enviorment. anyoune knows how? thanks.
There should be a button in the top right corner for changing perspectives. You can also get to it through theWindow > Open Perspectivemenu.
So how to create a function to return nearest up so nearest to 9 9+ 1 to given int leaving no remainder when divided by 2 int?
To round to the nearest int: ``` number+=(number & 1) ```
Is there aplatform-independentway to measure time up to micro seconds using C standard library?
The precision of the measurement depends on the operating system, unfortunately.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,visit the help center.Closed12 years ago. Diagram and program code in c is necessary.
http://www.codeproject.com/KB/recipes/ReverseLinkedList.aspx It's also on Google.
This is my code: ``` wchar_t wbuffer[512]; wchar_t* wc = (wchar_t*) malloc(buffer_size); int buflen = 0; // ... stuff // inside the while loop wbuffer[buflen] = (wchar_t)wc; ``` what is wrong with this?
Dereference wc within your loop. ``` wbuffer[buflen] = *wc; ```
Is there any way to find a unique hardware ID to a computer in C? (Windows)
How exactly would you define the "computer"? The CPU? What about the same CPU in a different MoBo?The MoBo? What if it gets a new BIOS? a new CPU?The graphics card? What if the machine has more than 1 GPU? and it gets upgraded? Once you define exactly what you're asking, you'll be much closer to an answer
I need to modify trackers in torrent files using C, What type of encoding do they use?? When I just print characters in ascii they print gibberish. Or is there a direct way of adding trackers to a torrent file using C?
Have you tried documenting yourself regarding .torrent file format ? TheWikipedia articleseems to be pretty complete on this question.
I am reusing a legacy C library in an iOS app and in an Android app. I want to customize some macro definitions (e.g. for logging). Are there standard defines to check for (using #ifdef) whether the code is being compiled for iOS or Android/NDK?
__ANDROID__orANDROIDfor Android (compilation with the NDK) and__APPLE__on Apple platforms (iOS or OSX)
I'm desperately looking for some C sample source code that describes how to implement a HID client using Bluez. More specifically, I would like to know how to write an application that sends keyboard inputs over bluetooth to another Linux system. (Really, the fact that the receiver is running Linux/Bluez shouldn't matter.) -Cheers
hidclienthttp://anselm.hoffmeister.be/computer/hidclient/index.html.en?
I'm searching for theomp.hfile for using it in eclipse. I failed to find it in openmp.org. Where do I findomp.h? thanks.
Under Linux, you can find a file by ``` locate omp.h ``` Have you tried to simply use it with ``` #include <omp.h> ``` and add the openmp flag to your g++ compiler flag? ``` g++ -fopenmp sample.c ```
I was wondering if the WinAPI or something has a way to get the raw data from a USB device, or something that would lead me in the right direction for this sort of thing. for example, for an midi device, this data might be the velocity, and which note was hit. Thanks
Not directly but you can now useusblibon windows
I need to modify trackers in torrent files using C, What type of encoding do they use?? When I just print characters in ascii they print gibberish. Or is there a direct way of adding trackers to a torrent file using C?
Have you tried documenting yourself regarding .torrent file format ? TheWikipedia articleseems to be pretty complete on this question.