Given 2 strings, write a function that returns the position of String B that matches String A if String A is a substring of String B. Otherwise return -1.
Example:
strA = "ello"
strB = "Hello_World"
Your function should return 1.
strA = "blah"
strB = "blha"
Your function should return -1.
...
Googling for "c ide -C++" produces too many results for C++, as well as unrelated results. These search terms seem too short to produce relevant results. Does anyone have a link to a free, Win32 C IDE that does step-through debugging like Visual Studio?
...
I am writing some small program in C--some log in, log out, create account, send message to another account deal--that I can build on and change and innovate and polish up to refine my skills in C.
What I am trying to figure out how to implement is part of the "compose message" option. After you are prompted for the recipient, subject, ...
I have this bit of code that is outputting the wrong results.
#include <stdio.h>
#include <string.h>
int main()
{
unsigned char bytes[4];
float flt=0;
bytes[0]=0xde;
bytes[1]=0xad;
bytes[2]=0xbe;
bytes[3]=0xef;
memcpy( &flt, bytes, 4);
printf("bytes 0x%x float %e\n", flt, flt);
return 0;
}
the output that I get ...
I need to repeatedly generate a Win32 DLL with a registration information function. This function uses literals to return customer specific registration information, with a separate DLL being built per customer.
I have a test version working correctly, with hard-coded information for one customer. The urgency for some sites dictates I...
Exact duplicate:
Why do Objective C files use the .m extension?
I'm thinking .h stands for header. I suppose .m could stand for main, but I don't know. Do any of you actually know this?
Just to clarify, I know what goes in which file, i.e. I know the purpose of each filetype, I'm just curious if the filetype symbol has a meaning.
...
I cannot get the following code to work.
#include <stdio.h>
// I am not sure whethere I should void here or not.
int main() {
// when the first bug is solved, I put here arg[0]. It should be
// similar command line parameter as args[0] in Java.
int a=3;
int b;
b = factorial(a);
// bug seems t...
How do I detect in my program that it's being run under a debugger? I am aware that this seems to indicate that I try to do something I shouldn't, and that is too messy. I think it is an interesting question tho. Specifically, is there a way to do it in a POSIX environment? For example using sigaction (2) to detect that some handler ...
How could i read..let's say 10 floats and add them in an array without wasting any memory?
...
Duplicate:
Best algorithm to count the number of set bits in a 32-bit integer?
Suppose you have a number. Is there any way to count the bits which equals to 1 in binary representation of that number, not using iteration? I mean, is there any way to do it in constant time using some bitwise operators and masks. I need solution whi...
I want to write c program which calls another exe. This wrapper c program does nothing but sets some environment variable before I call my original exec.
For example My original exec name is test.exe and I wrote testwrapper.exe
I want to call it as testrapper.exe < parameter >, internally it will should call test.exe < parameter >
My pr...
Edit: I think the WM_CREATE message isn't sent during the creation of child windows (namely my button). So by calling SendMessage during WM_CREATE, I'm sending a message to a window that hasn't been created yet. The solution for now is to call SendMessage() during the WM_SHOWWINDOW message. Do child windows send WM_CREATE messages at c...
Hello, I want to program against various databases in C. I want to know if all of the major database providers, Oracle, DB2, Sql Server, MySql have an api to use for C. If they all do can you give me some links to what the are but more specifically, how to work with the api?
thanks
...
Bearing in mind the answers given to a question about a safer formatting library for C, I'm wondering whether there is a safe C formatting library?
What I mean is:
there's no possibility to mismatch the format string from the arguments
there's no possibility to crash by passing the wrong type
there're no platform-dependent aspects
P...
I have a simple (and also trivial) banking application that I wrote in C++. I'm on ubuntu so I'm using GNOME (GTK+). I was wondering if I could write all my GUI in C/GTK+ and then somehow link it to my C++ code. Is this even possible?
Note: I don't want to use Qt or GTKmm, so please don't offer those as answers.
...
If I want to receive a one character input in C, how would I check to see if extra characters were sent, and if so, how would I clear that?
Is there a function which acts like getc(stdin), but which doesn't prompt the user to enter a character, so I can just put while(getc(stdin)!=EOF);? Or a function to peek at the next character in th...
I would like to initialize an array of structs, with the same element repetitively, ie
struct st ar[] = { {1,2}, {1,2}, {1,2} };
However I do NOT want to run any code for that, I wish that the layout of the memory upon program's execution would be like so, without any CPU instructions involved (it would increase boot time on very slow...
I have two numbers, and need to get returned the lower one. Is there any function I could use? Sure it's a easy task, I could do an if-statement. I just want to know.
...
I'm trying to convert some code from C# to C so that it can be burnt onto a microcontroller.
Could someone please tell me how I would convert a two dimensional string array in C# into something in C?
My C# code looks like this:
string[,] DirectionPosition = {{"00", "10", "", "01", ""},
{"01", "...
Let's say I have a file stream open and ready.
How do I seek a single byte in the stream and change it so that change is reflected on the file?
...