Go to Post Please try to apply GP to situations where it makes some sense, as otherwise you're just diluting the meaning. - Kevin Sevcik [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 26-01-2013, 20:50
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 157
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
Re: RGBImage Issues

This code will be running on the robot when it runs - don't know if that's obvious or not -- and as such, 'testPattern.jpg' must be on the robot and must be in the 'current working directory' of the running program. If you're feeling confident that all this makes sense so far, I would suggest that you try doing a little test to ensure that the file is really "there" by opening the file and reading the first 4 bytes of the file or something...if the following all checks out then I'd ask ... how are you creating this testPattern.jpg file? Could it have been saved in a different format than .jpg by a writing function? I seem to recall a situation last year where files we were writing wound up being BMP format instead of JPG due to a saving issue.

Code:
FILE* fp = fopen("testPattern.jpg", "rb");
if (fp) {
  unsigned char test[10];
  int read;

  read = fread(test, 1, 4, fp);
  if (read != 4) {
    printf("Did not read 4 bytes. Error.\n");
  }
  else {
    printf("SUCCESS. File at least exists.\n");
  }
}
else {
  printf("File not found.\n");
}
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 18:23.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi