Click here to Skip to main content
15,899,825 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDoes FreeRTOS have built-in support for queues that can hold variable sized elements? Pin
arnold_w12-Jul-20 10:06
arnold_w12-Jul-20 10:06 
AnswerRe: Does FreeRTOS have built-in support for queues that can hold variable sized elements? Pin
Richard MacCutchan12-Jul-20 21:14
mveRichard MacCutchan12-Jul-20 21:14 
AnswerRe: Does FreeRTOS have built-in support for queues that can hold variable sized elements? Pin
leon de boer21-Jul-20 19:32
leon de boer21-Jul-20 19:32 
QuestionWhat's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
arnold_w10-Jul-20 1:28
arnold_w10-Jul-20 1:28 
AnswerRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
Josh Gray210-Jul-20 3:30
Josh Gray210-Jul-20 3:30 
GeneralRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
arnold_w10-Jul-20 11:19
arnold_w10-Jul-20 11:19 
GeneralRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
k505410-Jul-20 11:52
mvek505410-Jul-20 11:52 
GeneralRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
Richard MacCutchan10-Jul-20 22:05
mveRichard MacCutchan10-Jul-20 22:05 
AnswerRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
CPallini12-Jul-20 20:33
mveCPallini12-Jul-20 20:33 
GeneralRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
arnold_w12-Jul-20 23:52
arnold_w12-Jul-20 23:52 
GeneralRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
Richard MacCutchan13-Jul-20 2:00
mveRichard MacCutchan13-Jul-20 2:00 
GeneralRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
arnold_w13-Jul-20 3:53
arnold_w13-Jul-20 3:53 
GeneralRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
Richard MacCutchan13-Jul-20 4:29
mveRichard MacCutchan13-Jul-20 4:29 
GeneralRe: What's the closest thing to anonymous function pointers I can achieve that compiles with GCC? Pin
arnold_w4-Aug-20 5:21
arnold_w4-Aug-20 5:21 
Questionuse argv while debugging Pin
chipp_zanuff4-Jul-20 20:08
chipp_zanuff4-Jul-20 20:08 
AnswerRe: use argv while debugging Pin
Richard MacCutchan4-Jul-20 21:09
mveRichard MacCutchan4-Jul-20 21:09 
GeneralRe: use argv while debugging Pin
chipp_zanuff4-Jul-20 22:15
chipp_zanuff4-Jul-20 22:15 
GeneralRe: use argv while debugging Pin
Richard MacCutchan4-Jul-20 22:19
mveRichard MacCutchan4-Jul-20 22:19 
GeneralRe: use argv while debugging Pin
chipp_zanuff4-Jul-20 23:15
chipp_zanuff4-Jul-20 23:15 
GeneralRe: use argv while debugging Pin
Richard MacCutchan5-Jul-20 0:11
mveRichard MacCutchan5-Jul-20 0:11 
You did not mention what error you received, but I assume it is because you are still trying to access an item which does not exist. The values for argc and argv are as follows:
1. argv is an array of strings, which will always contain at least one item: the name of the executable that is used to initiate the program.
2. argc contains the number of items in the argv array. So it will always be at least 1.

Let's look at a couple of examples:
1. A simple command line call to run my program, which is called Test.exe produces the following:
C:\Users\user1\Documents\Code\C++>Test.exe
argc = 1
argv[0] = Test.exe

There are no input parameters, argc equals 1 as there is only one item in argv, and that is argv[0] which contains the program name. If I use the full path to run the program the output will be:
C:\Users\user1\Documents\Code\C++>C:\Users\user1\Documents\Code\C++\Test
argc = 1
argv[0] = C:\Users\user1\Documents\Code\C++\Test

If we add some parameters to the command line we will get something like
C:\Users\user1\Documents\Code\C++>Test.exe one two "three and a half"
argc = 4
argv[0] = Test.exe
argv[1] = one
argv[2] = two
argv[3] = three and a half

So argv now contains 4 items, the program name followed by each item that is separated by a space or tab. Not that argv[3] contains four words, since they were delineated by double quotes in the command line.

The code to list these values is as follows:
C++
std::cout << "argc = " << argc << std::endl;
for (int i = 0; i < argc; ++i)
{
    std::cout << "argv[" << i << "] = " << argv[i] << std::endl;
}

Generally you are not interested in the program name so you can start the above loop from 1 rather than 0.

The actual values in each parameter are for you to decide. You can use simple strings in a specific or random order, option letters or names preceded by single or double dashes or forward slashes:
Test check \foo\bar\filename.txt
Test -c C:\user1\Documents\file.jpg
Test --check somefilename

... etc.

GeneralRe: use argv while debugging Pin
chipp_zanuff5-Jul-20 6:17
chipp_zanuff5-Jul-20 6:17 
GeneralRe: use argv while debugging Pin
Richard MacCutchan5-Jul-20 6:35
mveRichard MacCutchan5-Jul-20 6:35 
Questionpython language Pin
seotutorialszone4-Jul-20 10:40
seotutorialszone4-Jul-20 10:40 
AnswerRe: python language Pin
chipp_zanuff4-Jul-20 20:13
chipp_zanuff4-Jul-20 20:13 
AnswerRe: python language Pin
Richard MacCutchan4-Jul-20 21:06
mveRichard MacCutchan4-Jul-20 21:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.