#include <stdio.h>
#include <Windows.h>
int main()
{
TCHAR buff[1024];
GetLogicalDriveStrings(1024, buff);
int i;
for(i = 0; buff[i] != 0; i += 4)
printf("%S", buff+i);
}
When I try to compile it with MSVC, I get the following errors:
Commenting out GetLogicalDriveStrings(1024, buff); causes the code to com...
Hi All,
This is a small piece of code shown below which is using do while loops.
I really dont understand the unexpected behaviour i see when i execute this code.This code shown below uses a do while loop condition and from my knowledge a do while loops executes in such a way that if first executes the statement and then checks in the w...
if we declare char * p="hello"; then since it is written in data section we cannot modify the contents to which p points but we can modify the pointer itself. but i found this example in C Traps and Pitfalls
Andrew Koenig
AT&T Bell Laboratories
Murray Hill, New Jersey 07974
the example is
char *p, *q;
p = "xyz";
q = p;
q[1] = ’Y’;
q...
Is it fine to declare a global variable as auto.
for example
auto int i;
static int j;
int main()
{
...
return 0;
}
...
I need to find the duration of numerous formats of audio and video files, in milliseconds. I've been searching around for a while, but I can't find anything that will let me do this. I'm using C/++ in Linux. Thanks in advance.
...
if a variable is defined in a block is it present in the block only or throughout the program?
for example
main()
{
int j=5;
{
int i=10
printf("%d",i);
}
printf("%d , %d ",i,j);
}
is it valid
main()
{
int j=5, *k;
{
int i=10
printf("%d",i);
}
k=&i
printf("%d , %d ",...
I've seen posts talk about what might cause differences between Debug and Release builds, but I don't think anybody has addressed from a development standpoint what is the most efficient way to solve the problem.
The first thing I do when a bug appears in the Release build but not in Debug is I run my program through valgrind in hopes o...
What are the advantages and disadvantaghes of using libcurl and libsoup?
Which one is better to use for a HTTP operation where I have to send request to a server to get a response, and has a quick reaction time?
TIA,
Praveen
...
6.3.1.1 States
The rank of a signed integer type shall be greater than the rank of any signed integer type with less precision.
The rank of long long int shall be greater than the rank of long int, which shall be greater than the rank of int, which shall be greater than the rank of short int, which shall be greater than the rank of sig...
Sorry, I'm not even sure how to ask, since I'm a complete newbie at C, pointers and stuff like that. There's a function that accepts an argument: char **arg. If I write that argument like so:
char *cargs[] = {"blah", NULL};
and pass it to the function:
function(cargs);
it works. but ... I have an NSArray of NSStrings and I need to ...
C and many other languages have a conditional (aka ternary) operator. This allows you to make very terse choices between two values based on the truth of a condition, which makes expressions, including assignments, very concise.
I miss this because I find that my code has lots of conditional assignments that take four lines in Python:
...
Hey, recently (yay no more school) I've been teaching myself about the ELF file format. I've largely been following the documentation here: http://www.skyfree.org/linux/references/ELF_Format.pdf.
It was all going great, and I wrote this program to give me info about an ELF file's sections:
#include <stdio.h>
#include <stdlib.h>
#inclu...
Hi
Is there any way to retrieve the mac-address for the given ip-address from the ARP table without providing the Interface name ??
I do know the procedure of retrieving the mac address using ioctl call but in that case I should provide the interface name .. :(
One Crude Solution: Read /proc/net/arp file ... :( .. other than that .. a...
Please see comment:
static void drawAnObject() {
Form *form = [[Form alloc] init];
int i;
[form randomizeCube];
glColor3f(0.0, 0.0, 0.0);
for(i = 0; i < MAX_CUBE; i++) {
glutWireCube(form->cube[i]->size);
//compiler issues hard warning because form->cube is protected!!
}
}
I would rather ...
I want to store a general tree in C using parent pointer approach (a node store pointer to its parent node only). Is there any standard library for this?
Thanks in advance
...
I wanna refactoring my code. Now, this function is very mass cause it modified and modified several years to support multiple resolutions & multiple concept of UI design. So, one function for display has over then 10K lines. It need to be refactoring.
At first, I've concern about seperate functions for each resolution and UI design typ...
I have two large framework libraries, whose header files are included in my project. Either one works flawlessly, but including both causes erratic behaviour (but no error message related to the macro).
I assume that they both #define a macro of the same name. What is the most efficient way to identify the problematic macro?
...
What are the difference between a K&R function declarartion and an ANSI function declaration?
...
Hi.
Why utf8 symbols cannot be printed via glib functions?
Source code:
#include "glib.h"
#include <stdio.h>
int main() {
g_print("марко\n");
fprintf(stdout, "марко\n");
}
Build it like this:
gcc main.c -o main $(pkg-config glib-2.0 --cflags --libs)
You could see that glib can't print utf8 and fprintf can:
[marko@marko-...
I'm currently in the process of writing a CGI blog engine in C (fun project - don't hate! :) and I'd like to enable posting for every user that has a login on the machine the webserver is running on.
What is the correct way to see if a supplied login and password match against the systems login data?
Just to clarify, if I have a shell ...