Consider the following:
#define STR "some long string"
int main(int argc, char* argv[]) {
char c* = "some long string";
printf("%d\n", sizeof(c))
printf("%d\n", sizeof(STR));...
Type: Posts; User: Absurd
Consider the following:
#define STR "some long string"
int main(int argc, char* argv[]) {
char c* = "some long string";
printf("%d\n", sizeof(c))
printf("%d\n", sizeof(STR));...
Thanks.
I'll give it a try.
*I just wrote a long post, hit Submit New Thread and my post somehow vanished :mad:(doesn't appear anywhere)*
Anyway, I was playing around with the pciutils library (see my previous thread here) and...
You are a genius!
$ gcc my_example.c -L/usr/local/lib -Iproject/pciutils/lib/ -lpci -lz -ludev
$ ./a.out
flag
vendor id=ec10
vendor id=8c16
vendor id=8680
vendor id=8680
vendor id=8680
When I directed the linker to /usr/local/lib, it threw another thousand linking errors for some reason...
$ gcc my_example.c -L/usr/local/lib -Iproject/pciutils/lib/ -lpci...
The header file that is used when I do:
$ gcc -M my_example.c -Iproject/pciutils/lib/ -lpci
is project/pciutils/lib/pci.h, (meaning the one in project/pciutils/lib/), but that's just because I...
Thanks for your help guys.
This is going to be long, but please bare with me. This is very important for me, and is actually just a small part of a greater project I have already written (in...
Hey Salem. Thanks for the help.
I ran the top level makefile, and it looks like it creates some object files into pciutils/lib/, plus the pci.h is also at pciutils/lib.
So I ran the above example...
Hey.
I git cloned the pciutils repository (see here), and now I want to write my own version of lspci.
What do I need to do in order for this wonderful library to be available for me?
Note: I am...
Your approach is good in general, though there are still couple of problems that I could find:
1. You say you're gonna "break if there is equality and if not to save this number in a new array and...
Because (5/9) is 0. And 0 times anything gives 0.
EDIT
To be more specific: the expression you are probably looking for is: (f-32)*((float)5/9)
I thought about using structs, but that involves syntax changes that would require changing an existing code.
Isn't there a way to achieve the same results with primitives?
Can you suggest different method by which the above code would at least raise a warning by the compiler?
Take this code snippet as an example:
#include<stdio.h>
typedef unsigned foo_t;
typedef unsigned bar_t;
void func(foo_t foo) {
printf("foo=%u\n", foo);
afaik, you can't.
If "another c program" is not part of the binary of the running process, your only option is forking new child process, and mounting another_c_program's binary to it.
I have a PCIe device and I read its BAR through setpci. Now suppose I want to access this address space.
To my best understanding, this address space is a physical address space, and thus can not be...
Hey.
I'm trying to wrap my head around the idea of variadic macros, and I have several questions:
1. Is this a C++ thing, or does is also exist in C?
2. How do I use it?
3. What's the...
Ohh... OK. Now it all makes sense.
Thanks again!
OK, I cleared the fields one at a time:
int main(int argc, char* argv[]) {
struct pci_access* pacc;
struct pci_dev* dev;
pacc = pci_alloc();
pci_init(pacc);
You're right. That's not what I was aiming for... This should have been sizeof(struct pci_dev)...
Yes. The only reason for doing so was to see how it works.
Thanks!
That is actually what I was looking for. Its specification...
Sorry, I guess I should have been more clear about why I stuck these three lines there.
You see, I wanted to see if omitting the flags PCI_FILL_BASES | PCI_FILL_CLASS will cause pci_fill_info()...
I am trying to familiarize myself with pciutils-dev C library, and I came across this example file.
For simplicity, let me write (a mildly changed version of) example.c here:
int...
Thanks again for teaching me some more new stuff. Appreciate it.
Got it! Thank you.
One question though:
If the output operand determines where the compiler will store the result, then how can it be an expression? Doesn't it have to be an lvalue?