Aim of the program to is read to Atmega board, which has portb which is l.e.d .
When the input of +25 , it will move the stepper motor forward 25 , and negative -25 move it back.
I got stuck after reading the +/- and argv1.
any tutorials online or advice greatly appreciated

#include <iostream> 

#include <cstdlib> 

#include <string> 

#include <sstream> 

#include <string.h> 

#include <stdio.h> 



using namespace std; 





stringstream stst; 

string str ; 

int command(string *str) 
{ FILE *fpipe ; 

if ( !(fpipe = (FILE*)popen(str->c_str(),"r"))) 

{ cout << "pipe error" << endl ; 

exit(0) ; 

} 

char line[100] ; 

fgets( line, sizeof line, fpipe) ; 

pclose(fpipe) ; 

*str = line ;
return( atoi(line)) ; 

int main(int argc, char *argv[])


char *p; 

signed int para2 = strtol(argv[1], &p, 0); 





char q[100]; 

strncpy(q, argv[1], 2 ); 



char sign = q[0]; 







int clockwise_states[4] = {8,2,4,1}; 

int anticlockwise_states[4] = {1,4,2,8}; 







int msb; 

int value; 

int read; 



stst.str("");// clear 

str = "ousb -r io portb"; 

read = cpp_do_ousb_command(&str); 



value = read & 15; // getting only LSBs 

msb = read & 240; // getting only MSBs 















int i = 0; 

int j = 0; 

signed int steps = 0; 


The formatting makes it impossible to read. You have at least one bracket matching error, very hard to see due to the bad formatting. Format, fix the bracket matching errors, and try again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.