Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
S

styve

@styve
About
Posts
42
Topics
34
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Linux problem
    S styve

    Hi! I have done a little mistake. I have deleted a folder as a root with # rm -rf /folder Is there a command to restore the folder? Or were can I find the deleted folder? It is not in the trash. Help me, if it possible

    System Admin help linux question

  • hex to decimal
    S styve

    I'm using libpcap, and capturing the header of each packet. While it is a udp header, I will get the source port, byte 1 and byte 2. I'm reading one byte at the time with get(), so I cat them into one string. Probably I have put myself in a hard position to convert the string with hexadecimal numbers to decimal code: int main(){ ... while(!inFile.eof) { inFile.get(bin); ... if(count == 35) { sprintf(port1, "02X", bin); } if(count == 36) { sprintf(port, "%s%02X", port1, bin); } }

    C / C++ / MFC question tutorial

  • hex to decimal
    S styve

    How do i convert for example 2B67 in base 16 to decimal in base 10?? There is no command in sprintf??

    C / C++ / MFC question tutorial

  • hex to dec
    S styve

    Hi! Having problem by using sprintf. I have the hexadecimal 2B67, and will convert it to decimal by using sprintf. Can someone help me?? I know how to do vice verca.

    C / C++ / MFC help tutorial question

  • &255
    S styve

    Hi! What does &255 do? I have microseconds in 6 integers, and will place them in a 3 byte unsigned char[3] = {1, 2, 3}; I'm trying to use &255, but it doesn't work so well. Can someone help me with my problem?

    C / C++ / MFC help question

  • time in ascii
    S styve

    One letter or one digit that is stored to a file is one byte. If I only store A, the file is one byte. If I store 65, the file is two byte. It was that I meant

    C / C++ / MFC tutorial

  • time in ascii
    S styve

    Hi! Your solution were good. It made me think in another way. But there is one problem. How will I solve microseconds (6 digits)?? Two digits is one byte, so six digits willbe 3 byte??

    C / C++ / MFC tutorial

  • time in ascii
    S styve

    yes, I can use it, but then there will be digits. I will have it in ascii format, because it take less space in a file.

    C / C++ / MFC tutorial

  • lltostr
    S styve

    Hi! The command, char* lltostr(long long value, char* endptr), are not defined in string? How do I get it to work?

    C / C++ / MFC question

  • time in ascii
    S styve

    I'm using time.h, to get time of the day. In my code it is converted into number so it is possible to read the time. But I will have it in ascii format. I dont know how to do to get hour, min and sec into ascii. I will not have them converted into numbers. My code: time_t tid; tm * ptm; time(&tid); ptm = gmtime(&tid); struct timeval *Tps; struct timezone *Tzp; Tps = (struct timeval* ) malloc(sizeof(struct timeval)); Tzp = 0; gettimeofday(Tps, Tzp); hour = ptm->tm_hour; //become integers, will have ascii min = ptm->tm_min; sec = ptm ->tm_sec; //Stefan

    C / C++ / MFC tutorial

  • time synchronisation
    S styve

    I have some problem. I'm not sure how to do a program that synchronize the time for five computers. One computer will be a Master and get the time with ntp. And then sent a signal to the other four computer for example every 10 second. Is there someone that can help me get started and give me some hints how I should do? /stefan

    C / C++ / MFC help tutorial question

  • reading header
    S styve

    Hi! I'm recieving packets with pcap_next and store them to a file with pcap_dump. To double check I also copy the packet to a buffer and print the first five bytes at the console to see if they are the same as in the file. But they not. In the file the first packet come after 40 bytes. So I think it is the IP header 20 bytes + TCP header 20 bytes. Why are they not performed on the screen when I print them in the console? So I think, okey, then there will be 40 extra bytes for next paket too, but it is not. It is only 16 bytes??? and also next packet, and next ... Why is it 40 bytes for the first packet I recieve, and then 16 bytes for the packets I recieve after? Can someone explain this for a confused man, Stefan

    C / C++ / MFC question

  • sprintf
    S styve

    Hi! Is there a command that works like sprintf, but it is like strcat? Because I will catenate (probably wrong spelling) some hex numbers to the same char value. Have a nice day, Stefan

    C / C++ / MFC question

  • pcap with IP-TV, Transport Stream
    S styve

    Hi! I hace a problem. I'm using libpcap for linux and collecting packets from ip-tv. I know that one TS packet are 188 bytes and 7 of them can be put in a IP packet (1316 byte). When I recieving the IP packet there are 1358 bytes, recieved and the first TS packet start at the 42 bytes (TS starts with 0x47) at the IP packet (1358-42 = 1316 correct), but after 188 bytes further there will be 0x47 again to indicate that there is beginning of a new TS packet, and further 188bytes there will be 0x47 again, but it is not. Does someone know what is wrong? my code: ... while(1) { packet=pcap_next(handle, &header);//grab packet printf("packet with length of %s", header.len); for(counter=0; counter

    C / C++ / MFC question linux help

  • pcap_dump() problem
    S styve

    It was to simple to understand in the beginning, you always will do the hard way =) just put pcap_dump((u_char*)outFile, header, packet)

    C / C++ / MFC help sharepoint linux tutorial question

  • pcap_dump() problem
    S styve

    Hello! Im using libpcap for linux. I have a problem with the command pcap_dump(u_char *user, struct pcap_pkthdr *h, u_char *sp). The first argument will be the result from pcap_dump_open() (the file I will write to), but the problem is that it's not a u_char result from pcap_dump_open, it is a pcap_dumper_t. Is there a command for conversion from pcap_dumper_t to u_char? In the tutorial the first argument can be a pcap_dumper_t value, but it will not work. Thankful for your help, Stefan

    C / C++ / MFC help sharepoint linux tutorial question

  • file problem
    S styve

    Hi! I have a problem with saving packets to a file. A packet loss occur at time XXYY. Then I will name open a file name it to XXYY, store some packets, and then close the file. Next time a packet is losses I will open a new file with the name as time HHMM. But it will not work. It cannot open the file. Does anyone know how to do it??? Im store the time in a char buffer, and then I copy it into char Filename[20]. My code: void WriteToFile() { strcpy(Filename, time[line]) ofstream outFile; outFile.open(Filename, ios::out); if(!outFile){cout << "cant open file"<

    C / C++ / MFC ios help tutorial question

  • pcap problem
    S styve

    Hi! Having problem with my program. I'm looking up the device, but it will not be found. I'm trying to different ways. I know I have a device. With Tcpdump I can sniff packets at eth0. But my own program do not work. Does anyone know why it do not work? Thanksful for your help, Stefan My code: #include #include int main() { char *dev, *device, errbuf[PCAP_ERRBUF_SIZE]; pcap_t *kkk; dev = pcap_lookupdev(errbuf); kkk = pcap_open_live(device, 128, 0, 100, errbuf); printf("Device1: %s\n", dev); printf("Device2: %s\n", kkk); return 0; }

    C / C++ / MFC help question

  • capture packets at the device
    S styve

    Hi! My program joining a multicast group and recieves packets. But I will recieve the packets at the network device, so there will be no delays when it is placed in a queue at my computer. Does anyone know how listening at the device in c++? I'm using linux mandrake. Thanks for your help, Stefan

    C / C++ / MFC c++ sysadmin linux data-structures help

  • sprintf
    S styve

    Thank you! it was "ld" I missed.

    C / C++ / MFC help tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups