c

How do I translate LEX into C to work with the YACC grammar?

I have the following lexical analyzer calculator on LEX: %option noyywrap %{ #include <stdio.h> #include "y.tab.h" # ... I run it like this: yacc myyacc_calc.y and cc source.c y. tab.c-o example4. Can you help translate the c LEX analyzer to C?

Keep-alive can process only a fraction of requests in a single connection

I'm writing my http server, I needed to re-use the connection using keep-alive. I am trying to make sure that static requests ... ients[slot]!=-1) slot = (slot+1)%CONNMAX; } This code is a test code, and is taken from here Http://dpaste.com/2104P0V

Qsort in C structures

Hello. I really hope for your help. Trying to ride the qsort() function on C. There are certain problems. The program quickly ... horLast, booksA[i].value);}; } else if ((b>6)&&(b<1)) {printf("Ne vibraly? Its bad!\n"); return 0;}

How to transfer words from one array to another

Here, this program is passed through the text from test.txt, writes all words to the istr variable. I want words to be passed ... printf("%p\n", &strok[words]); printf("%s\n", strok[words]); } } fclose(fp); return 0; }

Testing the function in C

How to check how a function behaves on different data in C? Let's say there is a function that determines from three sides th ... 2; } if(a+b>c && b+c>a && a+c>b) { return 0; } else { return 1; } } Show an example of the test.

Header file conio.h

What kind of header file is , and what is it for? K&R doesn't describe it that way. Thank you in advance.

How to write a parser for Wavefront. obj in C

How to write a parser for Wavefront. obj in C? I'm new to C programming, no experience in writing a parser. Where to start? What is the general principle of the parser?

AT commands by UART STM32

I'm moving from arduino to stm32, there was a problem with the UART'om, or rather with understanding how to do it "beautifull ... buffer to create. Plus three more UART communication options, which one is better suited for emulating Arduino Serial.read()

TLS client in C++

At the moment, I am studying the OpenSSL library, namely, I want to make a TLS handshake between the client and the server. A ... of the client. I will also be happy to read an article on implementing the TLS protocol in C or C++, no matter what language.

Working with memory in C

I do not understand. You can output the memory cell number #include <stdio.h> int main(void){ int x = 0; prin ... } Lvalue required as left operand of assignment Or how to do it, I don't know. Correct or direct them to the right path...

encrypt a message with the crypto api

I use the microsoft crypto api to encrypt the message. Here is the code: char str[16] = "mamamama"; DWORD count = strlen(str ... Error(), "CryptEncrypt"); fclose(fp); } The last GetLastError returns error 234 - More data is available. What's wrong?

Remove comments from a C program

Please help me deal with one jamb in this program... The problem is that multi-line comments are not deleted, but they should ... slkj 4 /* khg dmflkdms fvsd kf;sd;l ////////piouhjkl 5 sxsalkxas // */ 6 \ // system ("pause"); 7 }

base64/UTF-16LE decoding in C

My problem is trying to decode a utf-16 encoded string that has been encrypted in base64. The result of such decoding is alwa ... har *)malloc(dest_size); memset(dest,0,dest_size); base64decode(source, dest, dest_size); printf("Decode: %s", dest); }

Arduino does not read the text sent through the port, but sees \n

That is, when using the code under Linux, the string with the arduino seems to work correctly, but the transfer somehow does ... if (getchar() == '\n') { close(serial_port); return 0; } else { goto L1; } }

The subtleties of working with the strdup function

Will it create strdup() '\0' at the end of a dynamic array? char buf[128]; buf[0] = 'x'; for(int i = 1; i < 64; i++) { buf[i] = i; } char *str = strdup(buf);

Arrays of bit fields in C

Regarding the structure with bit fields, I have seen this phrase: it is unacceptable to create arrays of bit fields, bit fiel ... to imagine an array of instances of a single structure field. Or is it that bit fields cannot themselves have an array type?

Add the contents of a binary file to an object file

There is a program that exports some data to a file in binary form. Is there a way to transfer the contents of a constant array, such as uint8_t, from a c file to a separate binary file for easy editing by a third-party program?

How to create a window in pure C using only the standard library according to the standard?

Good afternoon, everyone. How can I create my own window in bare C? This should be possible, since all third-party libraries with graphics are written in C. About windows.h and other tools do not write, I want to try to do it with my own hands.

Why does the program on yacc get segmentation fault?

I'm trying to run an example (4.3. Processing the config file) from this HOW-TO. This is the code that is submitted to the in ... ped) Can you explain why could there be a problem? If there is a problem with strdup, then how can it be avoided using it?

I have a problem lighting the LED in the microcontroller device discovery stm32f373

I used STM32 cube mx and the HAL library the program was executed, but the LED did not light up. Performed the work according ... for his controller.Description of STM32F3 HAL and low-layer drivers STM32F373xx If the Russian documentation is about this?