Linux open file dialog [closed] - c

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 months ago.
Improve this question
Im trying to program a open file dialog in C. I dont want to use any gui projects.
It seems there's XORG and wayland so I'm guessing I need to implement open file dialog for both of those.
So far my program looks like this
#ifdef _WIN32
OPENFILENAME ofd;
memset(&ofd,0,sizeof(ofd));
ofd.lStructSize = sizeof(ofd);
ofd.lpstrFile = filename;
ofd.nMaxFile = MAX_PATH;
ofd.Flags = OFN_FILEMUSTEXIST;
#endif
#ifdef __linux__
#endif

Related

What do I do when i receive this feedback after running a code in C? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 months ago.
Improve this question
Feedback after running code in vscode;
gcc : The term 'gcc' is not recognized as the name
of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a
path was included, verify that the path is correct
and try again.
At line:1 char:40
The code I input;
#include<stdio.h>
int main() {
printf("Hello World")
}
you need to install the gcc compiler on your system and it add to path. here u can take help.
https://www.scaler.com/topics/c/c-compiler-for-windows/

Running C program in Ubuntu [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have a set of C code files named as: hmc.c hopping.c phi4.c and I have an 'infile' which contains value of parameters and a 'Makefile'. How do I run these set of files in Ubuntu?
Previously in Windows I used gcc compiler with command 'gcc hmc.c hopping.c phi4.c' and then press Enter and then 'a infile' and that did the expected job but on Ubunut it isn't working..
Running the makefile should compile and give you an executable. You can do so by entering make in the command line. Make sure you have it installed first.

Is it possible to use the C API of lua in embedded systems? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to add some lua scripts to a firmware project writen in C. For now, the script is a config table, from which I'm trying to get the value of the num variable, all of this using the C API in the main.c file.
I'm testing this code including the standard source files of Lua for Desktop in my project (I have read about eLua, but the I don't need to implement the full code in Lua, I need to have Lua and C files coexisting in my project).
It works fine when I test this in the computer with the gcc compiler, but when I try to pass the same idea to my microcontroller with the cross compiler it compiles and there are no erros, but it seems to have problems getting the value from the lua file, because the variable valueFromLua always equals to 1.
My project folder tree has the following structure:
Source
main.c
Tools
lua
scripts
config_table.lua
config_table.lua
config_table = {
num = 10
}
main.c
lua_State *L = luaL_newstate();
uint8_t valueFromLua;
if(luaL_dofile(L, "./Tools/lua/scripts/config_table.lua") == LUA_OK)
{
lua_getglobal(L, "config_table");
if(lua_istable(L, -1))
{
lua_getfield(L, -1, "num");
valueFromLua = lua_tointeger(L, -1);
}
}
else
{
valueFromLua = 1;
}
I would appreciate your comments, thanks in advance.

How can I read a line from a file and check if that row contains an #include for call an header file? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am trying to read all the content of a .c file and print out in another .o file all the source code of the first file, replacing all the #include <....> in this way:
Input: #include<string.h>
Ouput: "string.h"
I have to work in pure C, without the chance to use any C++ libraries
Can someone please help me with this issue?
A simple sed on your file maybe?
sed 's/.*#include *\(<|"\)\(.*\)\(>|"\).*/"\2"/' < input.c > output.o

How do I play a music(MP3) or .Wav file using C libraries? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have tried using the fmod.h include file in C. But the tutorial I found for it was old/obsolete. Please can anyone give a program or an explanation as to how am I supposed to play some file in a C program using its libraries? Thanks in advance. Detailed explanation would be appreciated.
As you are working on Ubuntu, libvlc would be handy to use.
You should find the necessary files (libvlc.so, libvlc.pc, header files...) in a binary package called libvlc-dev.
Install it like :
sudo apt-get install libvlccore-dev libvlc-dev
Then here is the test program to play a file :
#include <stdio.h>
#include <stdlib.h>
#include <vlc/vlc.h>
int main(int argc, char **argv)
{
libvlc_instance_t *inst;
libvlc_media_player_t *mp;
libvlc_media_t *m;
// load the engine
inst = libvlc_new(0, NULL);
// create a file to play
m = libvlc_media_new_path(inst, "myFile.mp3");
// create a media play playing environment
mp = libvlc_media_player_new_from_media(m);
// release the media now.
libvlc_media_release(m);
// play the media_player
libvlc_media_player_play(mp);
sleep(10); // let it play for 10 seconds
// stop playing
libvlc_media_player_stop(mp);
// free the memory.
libvlc_media_player_release(mp);
libvlc_release(inst);
return 0;
}

Resources